From 78eb7b92d802e684a49160933894c4f0d95b103b Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sat, 2 Mar 2024 18:21:44 +0100 Subject: [PATCH] test: HandoverIT-POC - Not working fix: using `delay()` * Switched from `Mono.from(..).delayElement()` to `Mono.delay().then()`. * This does _not_ solve the problem, that all delays are calculated and scheduled, when the `Flux` is created. --- src/test/java/de/juplo/kafka/chat/backend/TestWriter.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/java/de/juplo/kafka/chat/backend/TestWriter.java b/src/test/java/de/juplo/kafka/chat/backend/TestWriter.java index 717a0f0e..03df1b86 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/TestWriter.java +++ b/src/test/java/de/juplo/kafka/chat/backend/TestWriter.java @@ -42,9 +42,9 @@ public class TestWriter } }) .map(i -> "Message #" + i) - .flatMap(message -> sendMessage(chatRoom, message) - .delayElement(Duration.ofMillis(ThreadLocalRandom.current().nextLong(500, 1500))) - .retryWhen(Retry.fixedDelay(10, Duration.ofSeconds(1)))) + .flatMap(message -> Mono + .delay(Duration.ofMillis(ThreadLocalRandom.current().nextLong(500, 1500))) + .thenMany(sendMessage(chatRoom, message).retryWhen(Retry.fixedDelay(10, Duration.ofSeconds(1))))) .doOnNext(message -> { sentMessages.add(message); -- 2.20.1