From 3d5f24e8e8fadfb181b73f1d1c4ff3364332141b Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Tue, 29 Aug 2023 19:36:15 +0200 Subject: [PATCH] FIX:ShardedChatHome --- .../chat/backend/persistence/inmemory/ShardedChatHome.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 -- 2.20.1