NetworkClient.leastLoadedNode should check if channel is ready
Author: Ismael Juma
Reviewers: Jason Gustafson
Closes from ijuma/kafka-5014-least-loaded-node-should-check-if-channel-is-ready
@@ -445,7 +445,7 @@ public class NetworkClient implements KafkaClient {
int idx = (offset + i) % nodes.size();
Node node = nodes.get(idx);
int currInflight = this.inFlightRequests.count(node.idString());
- if (currInflight == 0 && this.connectionStates.isReady(node.idString())) {
+ if (currInflight == 0 && isReady(node, now)) {
// if we find an established connection with no in-flight requests we can stop right away
log.trace("Found least loaded node {} connected with no in-flight requests", node);
return node;
