diff options
-rw-r--r-- | controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java | 4 | ||||
-rw-r--r-- | messagebus/src/test/java/com/yahoo/messagebus/SequencerTestCase.java | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java index 24e0bea3b44..c9719c3dd55 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java @@ -289,8 +289,8 @@ public class InternalStepRunner implements StepRunner { case LOAD_BALANCER_NOT_READY, PARENT_HOST_NOT_READY -> { logger.log(e.message()); // Consider splitting these messages in summary and details, on config server. Instant someTimeAfterStart = startTime.plusSeconds(200); - Instant inALittleWhile = controller.clock().instant().plusSeconds(60); - controller.jobController().locked(id, run -> run.sleepingUntil(someTimeAfterStart.isAfter(inALittleWhile) ? someTimeAfterStart : inALittleWhile)); + if (someTimeAfterStart.isAfter(controller.clock().instant())) + controller.jobController().locked(id, run -> run.sleepingUntil(someTimeAfterStart)); return result; } case NODE_ALLOCATION_FAILURE -> { diff --git a/messagebus/src/test/java/com/yahoo/messagebus/SequencerTestCase.java b/messagebus/src/test/java/com/yahoo/messagebus/SequencerTestCase.java index e13d370fe8c..b077de80467 100644 --- a/messagebus/src/test/java/com/yahoo/messagebus/SequencerTestCase.java +++ b/messagebus/src/test/java/com/yahoo/messagebus/SequencerTestCase.java @@ -116,6 +116,7 @@ public class SequencerTestCase { // This test queues up a lot of replies, and then has them all ready to return at once. int n = 10000; CountDownLatch latch = new CountDownLatch(n); + CountDownLatch started = new CountDownLatch(1); AtomicReference<Reply> waiting = new AtomicReference<>(); Executor executor = Executors.newSingleThreadExecutor(); MessageHandler sender = message -> { @@ -123,7 +124,8 @@ public class SequencerTestCase { Reply reply = new EmptyReply(); reply.swapState(message); reply.setMessage(message); - if ( ! waiting.compareAndSet(null, reply)) reply.popHandler().handleReply(reply); + if (waiting.compareAndSet(null, reply)) started.countDown(); + else reply.popHandler().handleReply(reply); }; if (Math.random() < 0.5) executor.execute(task); // Usually, RPC thread runs this. else task.run(); // But on, e.g., timeouts, it runs in the caller thread instead. @@ -147,6 +149,7 @@ public class SequencerTestCase { sent.add(message); } + assertTrue(started.await(10, TimeUnit.SECONDS)); waiting.get().popHandler().handleReply(waiting.get()); assertTrue(latch.await(10, TimeUnit.SECONDS), "All messages should obtain a reply within 10s"); assertEquals(Set.copyOf(sent), Set.copyOf(answered)); // Order is not guaranteed at all! |