]> juplo.de Git - demos/kafka/chat/commitdiff
fix: GREEN - Loading finishes, if info-topic is empty
authorKai Moritz <kai@juplo.de>
Sun, 24 Mar 2024 08:51:45 +0000 (09:51 +0100)
committerKai Moritz <kai@juplo.de>
Sun, 24 Mar 2024 19:28:52 +0000 (20:28 +0100)
src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/InfoChannel.java

index 95f7fb064b1271459102f79cd9f84dd9a245b61e..69f453212355cf38fdf4551f4d164f9aa05d3d3d 100644 (file)
@@ -204,8 +204,9 @@ public class InfoChannel implements Channel
         for (ConsumerRecord<String, AbstractMessageTo> record : records)
         {
           handleMessage(record);
-          updateNextOffset(record.partition(), record.offset() + 1);
+          this.nextOffset[record.partition()] = record.offset() + 1;
         }
+        updateChannelState();
       }
       catch (WakeupException e)
       {
@@ -218,9 +219,8 @@ public class InfoChannel implements Channel
     log.info("Exiting normally");
   }
 
-  private void updateNextOffset(int partition, long nextOffset)
+  private void updateChannelState()
   {
-    this.nextOffset[partition] = nextOffset;
     if (channelState == ChannelState.LOAD_IN_PROGRESS)
     {
       boolean loadInProgress = IntStream