lianetm commented on code in PR #15698:
URL: https://github.com/apache/kafka/pull/15698#discussion_r1579555839
##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/HeartbeatRequestManager.java:
##########
@@ -469,19 +469,33 @@ public void resetTimer() {
this.heartbeatTimer.reset(heartbeatIntervalMs);
}
+ /**
+ * Check if a heartbeat request should be sent on the current time. A
heartbeat should be
+ * sent if the heartbeat timer has expired, backoff has expired, and
there is no request
+ * in-flight.
+ */
@Override
public boolean canSendRequest(final long currentTimeMs) {
update(currentTimeMs);
return heartbeatTimer.isExpired() &&
super.canSendRequest(currentTimeMs);
}
- public long nextHeartbeatMs(final long currentTimeMs) {
+ public long timeToNextHeartbeatMs(final long currentTimeMs) {
if (heartbeatTimer.remainingMs() == 0) {
Review Comment:
They achieve the same here, and totally agree that `isExpired` is more
readable, fixed. (Sensible "since we're here..." to me too btw)
--
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]