diff --git a/src/main/java/io/cryostat/discovery/DiscoveryStorage.java b/src/main/java/io/cryostat/discovery/DiscoveryStorage.java index a32a6a772c..752a01675a 100644 --- a/src/main/java/io/cryostat/discovery/DiscoveryStorage.java +++ b/src/main/java/io/cryostat/discovery/DiscoveryStorage.java @@ -276,19 +276,25 @@ public void stop() { } } - private CompletableFuture pingPrune() { - List> futures = + private CompletableFuture pingPrune() { + List> futures = dao.getAll().stream() .map( plugin -> { UUID key = plugin.getId(); URI uri = plugin.getCallback(); return ping(HttpMethod.POST, uri) - .whenComplete( + .handle( (v, t) -> { if (t != null || !Boolean.TRUE.equals(v)) { + if (t != null) { + logger.warn( + ExceptionUtils + .getStackTrace(t)); + } removePlugin(key, uri); } + return null; }); }) .toList(); diff --git a/src/test/java/io/cryostat/discovery/DiscoveryStorageTest.java b/src/test/java/io/cryostat/discovery/DiscoveryStorageTest.java index d8a6519f74..18b3881e52 100644 --- a/src/test/java/io/cryostat/discovery/DiscoveryStorageTest.java +++ b/src/test/java/io/cryostat/discovery/DiscoveryStorageTest.java @@ -213,6 +213,8 @@ void removesPluginsIfCallbackRejected() throws Exception { @Test void removesPluginsIfCallbackFails() throws Exception { + Mockito.when(deployer.deploy(Mockito.any(), Mockito.anyBoolean())) + .thenReturn(Future.succeededFuture()); EnvironmentNode realm = new EnvironmentNode("realm", BaseNodeType.REALM, Map.of(), Set.of()); PluginInfo plugin =