From: Kai Moritz Date: Tue, 29 Aug 2023 17:36:15 +0000 (+0200) Subject: FIX:ShardedChatHome X-Git-Tag: rebase--2023-09-02--10-22~13 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=3d5f24e8e8fadfb181b73f1d1c4ff3364332141b;p=demos%2Fkafka%2Fchat FIX:ShardedChatHome --- diff --git a/src/main/java/de/juplo/kafka/chat/backend/persistence/inmemory/ShardedChatHome.java b/src/main/java/de/juplo/kafka/chat/backend/persistence/inmemory/ShardedChatHome.java index 4fa4d9bd..ac7a9808 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/persistence/inmemory/ShardedChatHome.java +++ b/src/main/java/de/juplo/kafka/chat/backend/persistence/inmemory/ShardedChatHome.java @@ -44,9 +44,9 @@ public class ShardedChatHome implements ChatHome public Mono 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