Skip to content

Commit 78cafdd

Browse files
committed
Do not check health of shared containers
1 parent 02e9f4f commit 78cafdd

4 files changed

Lines changed: 22 additions & 8 deletions

File tree

src/main/java/eu/openanalytics/containerproxy/backend/dispatcher/DefaultProxyDispatcher.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,9 @@ public boolean isProxyHealthy(Proxy proxy) {
8484
return containerBackend.isProxyHealthy(proxy);
8585
}
8686

87+
@Override
88+
public boolean isProxyHealthySupported() {
89+
return true;
90+
}
91+
8792
}

src/main/java/eu/openanalytics/containerproxy/backend/dispatcher/IProxyDispatcher.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,6 @@ default void stopProxy(Proxy proxy) throws ContainerProxyException {
4949
Proxy addRuntimeValuesAfterSpel(Authentication user, ProxySpec spec, Proxy proxy);
5050

5151
boolean isProxyHealthy(Proxy proxy);
52+
53+
boolean isProxyHealthySupported();
5254
}

src/main/java/eu/openanalytics/containerproxy/backend/dispatcher/proxysharing/ProxySharingDispatcher.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,11 @@ public boolean isProxyHealthy(Proxy proxy) {
226226
return true;
227227
}
228228

229+
@Override
230+
public boolean isProxyHealthySupported() {
231+
return false;
232+
}
233+
229234
@EventListener
230235
public void onSeatAvailableEvent(SeatAvailableEvent event) {
231236
if (!Objects.equals(event.getSpecId(), proxySpec.getId())) {

src/main/java/eu/openanalytics/containerproxy/service/ProxyService.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -444,14 +444,16 @@ public Command resumeProxy(Authentication user, Proxy proxy, Map<String, String>
444444
}
445445

446446
public boolean isProxyHealthy(Proxy proxy) {
447-
for (int i = 0; i < 5; i++) {
448-
if (!proxyDispatcherService.getDispatcher(proxy.getSpecId()).isProxyHealthy(proxy)) {
449-
return false;
450-
}
451-
try {
452-
// wait for events to propagate
453-
Thread.sleep(1_000);
454-
} catch (InterruptedException ignored) {
447+
if (proxyDispatcherService.getDispatcher(proxy.getSpecId()).isProxyHealthySupported()) {
448+
for (int i = 0; i < 5; i++) {
449+
if (!proxyDispatcherService.getDispatcher(proxy.getSpecId()).isProxyHealthy(proxy)) {
450+
return false;
451+
}
452+
try {
453+
// wait for events to propagate
454+
Thread.sleep(1_000);
455+
} catch (InterruptedException ignored) {
456+
}
455457
}
456458
}
457459
if (proxy.getTargets().isEmpty()) {

0 commit comments

Comments
 (0)