From 89b5eb1eaf7890c830848dbc4281add2bff41131 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Fri, 15 Mar 2024 16:22:14 +0100 Subject: [PATCH] WIP:fix:activation --- .../chat/backend/implementation/kafka/DataChannel.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/DataChannel.java b/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/DataChannel.java index 42f17d14..abe51f4a 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/DataChannel.java +++ b/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/DataChannel.java @@ -341,9 +341,17 @@ public class DataChannel implements Channel, ConsumerRebalanceListener void createChatRoomData(ChatRoomInfo chatRoomInfo) { - computeChatRoomData( + int shard = chatRoomInfo.getShard(); + + ChatRoomData chatRoomData = computeChatRoomData( chatRoomInfo.getId(), chatRoomInfo.getShard()); + + // TODO: Possible race-condition in case of an ongoing rebalance! + if (isShardOwned[shard]) + { + chatRoomData.activate(); + } } Mono getChatRoomData(int shard, UUID id) -- 2.20.1