lucasbru commented on code in PR #15723: URL: https://github.com/apache/kafka/pull/15723#discussion_r1567484668
########## clients/src/test/java/org/apache/kafka/clients/consumer/internals/RequestStateTest.java: ########## @@ -48,4 +50,51 @@ public void testRequestStateSimple() { state.reset(); assertTrue(state.canSendRequest(200)); } + + @Test + public void testTrackInflightOnSuccessfulAttempt() { + testTrackInflight(RequestState::onSuccessfulAttempt); + } + + @Test + public void testTrackInflightOnFailedAttempt() { + testTrackInflight(RequestState::onFailedAttempt); + } + + /** + * In some cases, the network layer is <em>very</em> fast and can send out a second request within the same + * millisecond timestamp as receiving the first response. + * + * <p/> + * + * The previous logic for tracking inflight status used timestamps: if the timestamp from the last received + * response was <em>less</em> than the timestamp from the last sent request, we'd interpret that as having an + * inflight request. However, this approach would incorrectly return <code>false</code> from + * {@link RequestState#requestInFlight()} if the two timestamps were <em>equal</em>. + */ Review Comment: yeah I also noticed this. I think this parapraph fits best in the commit message / PR description. -- 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