cadonna commented on code in PR #15698:
URL: https://github.com/apache/kafka/pull/15698#discussion_r1574660830


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/HeartbeatRequestManager.java:
##########
@@ -482,6 +484,14 @@ public long nextHeartbeatMs(final long currentTimeMs) {
             return heartbeatTimer.remainingMs();
         }
 
+        public void onFailedAttempt(final long currentTimeMs) {
+            // Expire timer to allow sending HB after a failure. After a 
failure, a next HB may be
+            // needed with backoff (ex. errors that lead to retries, like 
coordinator load error),
+            // or immediately (ex. errors that lead to rejoining, like fencing 
errors).
+            heartbeatTimer.update(heartbeatTimer.currentTimeMs() + 
heartbeatTimer.remainingMs());

Review Comment:
   Your change to `heartbeatTimer.reset(0)` is not totally equivalent  to 
`heartbeatTimer.update(heartbeatTimer.currentTimeMs() + 
heartbeatTimer.remainingMs());` because in the former the `heartbeatTimer` is 
not expired until `heartbeatTimer.update()` is called, whereas in the latter 
the heartbeat is expired after the call, but I think in this specific case it 
does not matter. Is my assumption correct?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to