ivanyu commented on code in PR #13277: URL: https://github.com/apache/kafka/pull/13277#discussion_r1635256179
########## clients/src/main/java/org/apache/kafka/clients/NetworkClient.java: ########## @@ -705,16 +715,25 @@ public Node leastLoadedNode(long now) { Node foundCanConnect = null; Node foundReady = null; + boolean atLeastOneNodeConnected = false; + int offset = this.randOffset.nextInt(nodes.size()); for (int i = 0; i < nodes.size(); i++) { int idx = (offset + i) % nodes.size(); Node node = nodes.get(idx); + + if (!atLeastOneNodeConnected + && connectionStates.isReady(node.idString(), now) + && selector.isChannelReady(node.idString())) { + atLeastOneNodeConnected = true; Review Comment: Right, I added some unit testing -- 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