philipnee commented on code in PR #14937: URL: https://github.com/apache/kafka/pull/14937#discussion_r1419350301
########## clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerNetworkThread.java: ########## @@ -274,79 +269,18 @@ private void closeInternal(final Duration timeout) { } void cleanup() { + log.trace("Closing the consumer network thread"); + Timer timer = time.timer(closeTimeout); try { - log.trace("Closing the consumer network thread"); - Timer timer = time.timer(closeTimeout); - maybeAutocommitOnClose(timer); runAtClose(requestManagers.entries(), networkClientDelegate, timer); - maybeLeaveGroup(timer); } catch (Exception e) { log.error("Unexpected error during shutdown. Proceed with closing.", e); } finally { + networkClientDelegate.awaitPendingRequests(timer); Review Comment: it seems like there's network poll in both runAtClose and here. We really only need to poll it in a single place. I wonder if we could just remove the polls in runAtClose() and try to send out the requests here. -- 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