m1a2st commented on code in PR #17440:
URL: https://github.com/apache/kafka/pull/17440#discussion_r1806734056


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java:
##########
@@ -1132,7 +1135,11 @@ private Map<TopicPartition, Long> 
beginningOrEndOffset(Collection<TopicPartition
 
             Map<TopicPartition, OffsetAndTimestampInternal> 
offsetAndTimestampMap;
             try {
-                offsetAndTimestampMap = 
applicationEventHandler.addAndGet(listOffsetsEvent);
+                applicationEventHandler.add(listOffsetsEvent);
+                offsetAndTimestampMap = processBackgroundEvents(
+                        listOffsetsEvent.future(),
+                        timer, __ -> false
+                );

Review Comment:
   > Is it sufficient to perform a single check of the background events before 
submitting the application event, or do we really need to perform multiple 
checks of the background events while we wait for the application event to 
complete?
   
   It can't process ` processBackgroundEvents()` only once before 
`applicationEventHandler.addAndGet`. Test will be fail if I change to below, I 
think a loop for processBackgroundEvents is necessary
   ```java
    processBackgroundEvents();
   offsetAndTimestampMap = applicationEventHandler.addAndGet(listOffsetsEvent);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to