FIX:ShardedChatHome
authorKai Moritz <kai@juplo.de>
Tue, 29 Aug 2023 17:36:15 +0000 (19:36 +0200)
committerKai Moritz <kai@juplo.de>
Tue, 29 Aug 2023 17:36:15 +0000 (19:36 +0200)
src/main/java/de/juplo/kafka/chat/backend/persistence/inmemory/ShardedChatHome.java

index 4fa4d9b..ac7a980 100644 (file)
@@ -44,9 +44,9 @@ public class ShardedChatHome implements ChatHome
   public Mono<ChatRoom> getChatRoom(UUID id)
   {
     int shard = selectShard(id);
-    if (chatHomes[shard] == null)
-      throw new ShardNotOwnedException(shard);
-    return chatHomes[shard].getChatRoom(id);
+    return chatHomes[shard] == null
+        ? Mono.error(new ShardNotOwnedException(shard))
+        : chatHomes[shard].getChatRoom(id);
   }
 
   @Override