RDS port issue fixed
This commit is contained in:
@@ -6030,7 +6030,7 @@ public class RdsService implements Resettable, ResourceProvider {
|
|||||||
int base = config.services().rds().proxyBasePort();
|
int base = config.services().rds().proxyBasePort();
|
||||||
int max = config.services().rds().proxyMaxPort();
|
int max = config.services().rds().proxyMaxPort();
|
||||||
for (int port = base; port <= max; port++) {
|
for (int port = base; port <= max; port++) {
|
||||||
if (usedPorts.add(port)) {
|
if (!persistedResourceUsesProxyPort(port) && usedPorts.add(port)) {
|
||||||
return port;
|
return port;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6038,6 +6038,12 @@ public class RdsService implements Resettable, ResourceProvider {
|
|||||||
"No available proxy ports in range " + base + "-" + max, 503);
|
"No available proxy ports in range " + base + "-" + max, 503);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean persistedResourceUsesProxyPort(int port) {
|
||||||
|
return allInstances().stream().anyMatch(instance -> instance.getProxyPort() == port)
|
||||||
|
|| allClusters().stream().anyMatch(cluster -> cluster.getProxyPort() == port)
|
||||||
|
|| allProxies().stream().anyMatch(proxy -> proxy.getProxyPort() == port);
|
||||||
|
}
|
||||||
|
|
||||||
private void releaseProxyPort(int port) {
|
private void releaseProxyPort(int port) {
|
||||||
usedPorts.remove(port);
|
usedPorts.remove(port);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user