philipnee commented on PR #15525:
URL: https://github.com/apache/kafka/pull/15525#issuecomment-2023293507

   @lucasbru - If I'm not mistaken, the current implementation for both 
beginningOrEndOffsets and OffsetsForTimes both need to send out a request upon 
getting ZERO duration.  Seems like both code paths are invoking this logic
   ```
               // if timeout is set to zero, do not try to poll the network 
client at all
               // and return empty immediately; otherwise try to get the 
results synchronously
               // and throw timeout exception if it cannot complete in time
               if (timer.timeoutMs() == 0L)
                   return result;
   ```
   
   But the offsets for time seems to shortcircuit it here:
   ```
               // If timeout is set to zero return empty immediately; otherwise 
try to get the results
               // and throw timeout exception if it cannot complete in time.
               if (timeout.toMillis() == 0L)
                   return listOffsetsEvent.emptyResult();
   
               return applicationEventHandler.addAndGet(listOffsetsEvent, 
timer);
   ```
   
   I'll create a ticket to align the behavior of these two APIs in the new 
consumers.


-- 
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