jsancio commented on code in PR #20354: URL: https://github.com/apache/kafka/pull/20354#discussion_r2276816343
########## raft/src/main/java/org/apache/kafka/raft/KafkaRaftClient.java: ########## @@ -3363,10 +3366,14 @@ private long pollFollowerAsObserver(FollowerState state, long currentTimeMs) { } else { backoffMs = maybeSendFetchToBestNode(state, currentTimeMs); } - return Math.min( - backoffMs, - state.remainingUpdateVoterSetPeriodMs(currentTimeMs) - ); + if (shouldSendAddOrRemoveVoterRequest()) { + return Math.min( + backoffMs, + state.remainingUpdateVoterSetPeriodMs(currentTimeMs) + ); + } else { + return backoffMs; + } Review Comment: Can you change the implementation so that `shouldSendAddOrRemoveVoterRequest` is only evaluated once? You can also change the back off computation to something like: ```java return Math.min( backoffMs, shouldSendAddOrRemoveVoterRequest ? state.remainingUpdateVoterSetPeriodMs(currentTimeMs) : Integer.MAX_VALUE ); ``` -- 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