WIP:refactor
authorKai Moritz <kai@juplo.de>
Wed, 25 Jan 2023 16:49:28 +0000 (17:49 +0100)
committerKai Moritz <kai@juplo.de>
Wed, 25 Jan 2023 16:49:28 +0000 (17:49 +0100)
src/main/java/de/juplo/kafka/chat/backend/domain/ChatRoom.java

index a42434b..9ae967b 100644 (file)
@@ -69,9 +69,7 @@ public class ChatRoom
         .getMessage(key)
         .flatMap(existing -> text.equals(existing.getMessageText())
             ? Mono.just(existing)
-            : Mono.error(() -> new MessageMutationException(existing, text)))
-        .onErrorReturn(
-            service
+            : service
               .persistMessage(key, LocalDateTime.now(clock), text)
               .doOnNext(m ->
               {
@@ -80,7 +78,7 @@ public class ChatRoom
                 {
                   log.warn("Emitting of message failed with {} for {}", result.name(), m);
                 }
-              }).block());
+              }));
   }