From f36c65e847a54eda6f0701182a54b64361ab8508 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Wed, 25 Jan 2023 17:45:59 +0100 Subject: [PATCH] WIP:refactor --- .../java/de/juplo/kafka/chat/backend/domain/ChatRoom.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/juplo/kafka/chat/backend/domain/ChatRoom.java b/src/main/java/de/juplo/kafka/chat/backend/domain/ChatRoom.java index f5e3b06b..a42434b8 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/domain/ChatRoom.java +++ b/src/main/java/de/juplo/kafka/chat/backend/domain/ChatRoom.java @@ -70,7 +70,7 @@ public class ChatRoom .flatMap(existing -> text.equals(existing.getMessageText()) ? Mono.just(existing) : Mono.error(() -> new MessageMutationException(existing, text))) - .switchIfEmpty( + .onErrorReturn( service .persistMessage(key, LocalDateTime.now(clock), text) .doOnNext(m -> @@ -80,7 +80,7 @@ public class ChatRoom { log.warn("Emitting of message failed with {} for {}", result.name(), m); } - })); + }).block()); } -- 2.20.1