From 7c085ad58c3b99a48de8b88d9c251f21531c72e0 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Thu, 14 Mar 2024 12:49:29 +0100 Subject: [PATCH] fix: `ChatRoomData` must only be activated after restoring completes --- .../implementation/inmemory/SimpleChatHomeService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/juplo/kafka/chat/backend/implementation/inmemory/SimpleChatHomeService.java b/src/main/java/de/juplo/kafka/chat/backend/implementation/inmemory/SimpleChatHomeService.java index 8e3cc430..e78b049b 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/implementation/inmemory/SimpleChatHomeService.java +++ b/src/main/java/de/juplo/kafka/chat/backend/implementation/inmemory/SimpleChatHomeService.java @@ -81,10 +81,11 @@ public class SimpleChatHomeService implements ChatHomeService clock, chatMessageService, historyLimit); - chatRoomData.activate(); this.chatRoomData.put(info.getId(), chatRoomData); - return chatMessageService.restore(storageStrategy); + return chatMessageService + .restore(storageStrategy) + .doOnSuccess(noResult -> chatRoomData.activate()); }) .count() .doOnSuccess(count -> log.info("Restored {} with {} chat-rooms", this, count)) -- 2.20.1