dajac commented on code in PR #14557: URL: https://github.com/apache/kafka/pull/14557#discussion_r1426802152
########## clients/src/main/java/org/apache/kafka/clients/consumer/internals/CommitRequestManager.java: ########## @@ -780,6 +981,28 @@ List<NetworkClientDelegate.UnsentRequest> drain(final long currentTimeMs) { return Collections.unmodifiableList(unsentRequests); } + /** + * Find the unsent commit requests that have expired, remove them and complete their + * futures with a TimeoutException. + */ + private void failAndRemoveExpiredCommitRequests(final long currentTimeMs) { + List<OffsetCommitRequestState> expiredRequests = unsentOffsetCommits.stream() + .filter(req -> req.isExpired(currentTimeMs)).collect(Collectors.toList()); + unsentOffsetCommits.removeAll(expiredRequests); Review Comment: This seems inefficient. Would it be better to use an iterator and to remove with it? -- 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