diff options
author | jonmv <venstad@gmail.com> | 2023-06-12 16:18:14 +0200 |
---|---|---|
committer | jonmv <venstad@gmail.com> | 2023-06-12 16:18:14 +0200 |
commit | c597d198dd15ba1147d2b78941ed16b45a776ee7 (patch) | |
tree | b54fee390c17cb5242c33666dd161ced0fc9eb9a | |
parent | fbc1d03e255878b20a5c7e36e355ecd635f3a930 (diff) |
When all targets are inactive, there is not iterator.next later
-rw-r--r-- | controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicies.java | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicies.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicies.java index 2726c778218..770957b19d2 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicies.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicies.java @@ -292,16 +292,9 @@ public class RoutingPolicies { // If all targets are configured OUT, all targets are kept IN. We do this because otherwise removing 100% of // the ALIAS records would cause the application endpoint to stop resolving entirely (NXDOMAIN). - for (var kv : targetsByEndpoint.entrySet()) { - Endpoint endpoint = kv.getKey(); - Set<Target> activeTargets = kv.getValue(); - if (!activeTargets.isEmpty()) { - continue; - } - Set<Target> inactiveTargets = inactiveTargetsByEndpoint.get(endpoint); - activeTargets.addAll(inactiveTargets); - inactiveTargets.clear(); - } + targetsByEndpoint.forEach((endpoint, targets) -> { + if (targets.isEmpty()) targets.addAll(inactiveTargetsByEndpoint.remove(endpoint)); + }); targetsByEndpoint.forEach((applicationEndpoint, targets) -> { // Where multiple zones are permitted, they all have the same routing policy, and nameServiceForwarder (below). |