FIX:delay_vs_delayElements
authorKai Moritz <kai@juplo.de>
Sun, 3 Mar 2024 09:08:36 +0000 (10:08 +0100)
committerKai Moritz <kai@juplo.de>
Sun, 3 Mar 2024 09:08:36 +0000 (10:08 +0100)
src/test/java/de/juplo/kafka/chat/backend/TestWriter.java

index 133a768..0d2c41e 100644 (file)
@@ -42,10 +42,10 @@ public class TestWriter
             return i++;
           }
         })
+        .delayElements(Duration.ofMillis(ThreadLocalRandom.current().nextLong(500, 1500)))
         .map(i -> "Message #" + i)
-        .flatMap(message -> Mono
-            .delay(Duration.ofMillis(ThreadLocalRandom.current().nextLong(500, 1500)))
-            .thenMany(sendMessage(chatRoom, message).retryWhen(Retry.fixedDelay(10, Duration.ofSeconds(1)))))
+        .flatMap(message -> sendMessage(chatRoom, message)
+            .retryWhen(Retry.fixedDelay(10, Duration.ofSeconds(1))))
         .doOnNext(message ->
         {
           sentMessages.add(message);