diff options
author | Jon Marius Venstad <jonmv@users.noreply.github.com> | 2022-11-25 13:12:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-25 13:12:34 +0100 |
commit | a2d341cd95399ace53d85014a38f0412f2da2eb1 (patch) | |
tree | 28e3369ea7f0118a5400cb27fc83219b6c34d2da | |
parent | 841bd52428696d6f6617da90456605666ac9c159 (diff) | |
parent | 749ecea6161ff3bb694058609ee17d615d3fd02b (diff) |
Merge pull request #24991 from vespa-engine/jonmv/take-lock
Take name service queue lock
-rw-r--r-- | controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicies.java | 10 |
1 files changed, 6 insertions, 4 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 4e2eb03f01d..d721528f13b 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 @@ -383,10 +383,12 @@ public class RoutingPolicies { nameServiceForwarderIn(allocation.deployment.zoneId()).createTxt(challenge.name(), List.of(challenge.data()), Priority.high); Instant doom = controller.clock().instant().plusSeconds(30); while (controller.clock().instant().isBefore(doom)) { - if (controller.curator().readNameServiceQueue().requests().stream() - .noneMatch(request -> request.name().equals(Optional.of(challenge.name())))) { - challenge.trigger().run(); - return; + try (Mutex lock = controller.curator().lockNameServiceQueue()) { + if (controller.curator().readNameServiceQueue().requests().stream() + .noneMatch(request -> request.name().equals(Optional.of(challenge.name())))) { + challenge.trigger().run(); + return; + } } Thread.sleep(100); } |