kirktrue commented on code in PR #19609:
URL: https://github.com/apache/kafka/pull/19609#discussion_r2076562610


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerNetworkThread.java:
##########
@@ -154,16 +153,12 @@ void runOnce() {
         lastPollTimeMs = currentTimeMs;
 
         final long pollWaitTimeMs = requestManagers.entries().stream()
-                .filter(Optional::isPresent)
-                .map(Optional::get)
                 .map(rm -> rm.poll(currentTimeMs))
                 .map(networkClientDelegate::addAll)
                 .reduce(MAX_POLL_TIMEOUT_MS, Math::min);

Review Comment:
   Yes, the polling timeout logic is a little... "hard to understand" 😞
   
   The idea was that we want to block in `poll()` so that we're not just 
looping in `runOnce()` continuously. The amount of time to block is dependent 
on the inflight requests. Some requests, like coordinator discovery, don't want 
to wait at all, but others don't want to impose any timeouts on blocking in 
`runOnce()`.
   
   But yes, this is an area that could use some clean up.



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