From: Kai Moritz Date: Sat, 3 Feb 2024 16:25:45 +0000 (+0100) Subject: fix: `getChatRoomInfo()` thrwos `LoadInProgressException` when loading X-Git-Tag: rebase--2024-02-20--10-29~18 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=61092e42b7243e56a80c6b27c0f462660b14e62d;p=demos%2Fkafka%2Fchat fix: `getChatRoomInfo()` thrwos `LoadInProgressException` when loading - The method `InfoChannel.getChatRoomInfo(UUID)` has to check, if loading is in process. - Otherwise, an existing chat-room might erronously not be found, if it is requested, while `InfoChannel` is loading, because it is not yet loaded. --- diff --git a/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/InfoChannel.java b/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/InfoChannel.java index e6c18c77..2df7573c 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/InfoChannel.java +++ b/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/InfoChannel.java @@ -1,6 +1,7 @@ package de.juplo.kafka.chat.backend.implementation.kafka; import de.juplo.kafka.chat.backend.domain.ChatRoomInfo; +import de.juplo.kafka.chat.backend.domain.exceptions.LoadInProgressException; import de.juplo.kafka.chat.backend.implementation.kafka.messages.AbstractMessageTo; import de.juplo.kafka.chat.backend.implementation.kafka.messages.info.EventChatRoomCreated; import de.juplo.kafka.chat.backend.implementation.kafka.messages.info.EventShardAssigned; @@ -288,6 +289,11 @@ public class InfoChannel implements Runnable Mono getChatRoomInfo(UUID id) { + if (loadInProgress) + { + return Mono.error(new LoadInProgressException()); + } + return Mono.fromSupplier(() -> chatRoomInfo.get(id)); }