diff options
author | Ola Aunronning <olaa@yahooinc.com> | 2022-12-19 10:58:00 +0100 |
---|---|---|
committer | Ola Aunronning <olaa@yahooinc.com> | 2022-12-19 10:58:00 +0100 |
commit | f3e9a7e9a44b6295f2c4e9d281ab6d47dde20c52 (patch) | |
tree | c081075931d2a05ee434645ac6bfb971b6a4db34 /controller-server | |
parent | d98918a1419fd9b893852dc8d6e64bf2b1010314 (diff) |
ResourceTagMaintainer handles ConnectTimeoutException
Diffstat (limited to 'controller-server')
-rw-r--r-- | controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ResourceTagMaintainer.java | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ResourceTagMaintainer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ResourceTagMaintainer.java index 705abd9ed56..f11732f742b 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ResourceTagMaintainer.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ResourceTagMaintainer.java @@ -10,6 +10,7 @@ import com.yahoo.vespa.hosted.controller.Controller; import com.yahoo.vespa.hosted.controller.api.integration.aws.ResourceTagger; import com.yahoo.vespa.hosted.controller.api.integration.configserver.Node; import com.yahoo.vespa.hosted.controller.api.integration.configserver.NodeFilter; +import org.apache.hc.client5.http.ConnectTimeoutException; import java.time.Duration; import java.util.Map; @@ -46,15 +47,24 @@ public class ResourceTagMaintainer extends ControllerMaintainer { } private Map<HostName, ApplicationId> getTenantOfParentHosts(ZoneId zoneId) { - return controller().serviceRegistry().configServer().nodeRepository() - .list(zoneId, NodeFilter.all()) - .stream() - .filter(node -> node.type().isHost()) - .collect(Collectors.toMap( - Node::hostname, - this::getApplicationId, - (node1, node2) -> node1 - )); + try { + return controller().serviceRegistry().configServer().nodeRepository() + .list(zoneId, NodeFilter.all()) + .stream() + .filter(node -> node.type().isHost()) + .collect(Collectors.toMap( + Node::hostname, + this::getApplicationId, + (node1, node2) -> node1 + )); + } catch (Exception e) { + if (e.getCause() instanceof ConnectTimeoutException) { + // Usually transient - try again later + log.warning("Unable to retrieve hosts from " + zoneId.value()); + return Map.of(); + } + throw e; + } } private ApplicationId getApplicationId(Node node) { |