mirror of https://github.com/grpc/grpc-node.git
Merge pull request #2916 from murgatroid99/grpc-js-xds_ring_hash_fix
grpc-js-xds: ring_hash: Fix proactive connect logic when already connecting
This commit is contained in:
commit
a8142c2bcb
|
@ -249,16 +249,20 @@ class RingHashLoadBalancer implements LoadBalancer {
|
|||
if (!(this.currentState === connectivityState.TRANSIENT_FAILURE || this.currentState === connectivityState.CONNECTING)) {
|
||||
return;
|
||||
}
|
||||
let firstIdleChild: LeafLoadBalancer | null = null;
|
||||
for (const leaf of this.leafMap.values()) {
|
||||
const leafState = leaf.getConnectivityState();
|
||||
if (leafState === connectivityState.CONNECTING) {
|
||||
firstIdleChild = null;
|
||||
break;
|
||||
}
|
||||
if (leafState === connectivityState.IDLE) {
|
||||
leaf.startConnecting();
|
||||
break;
|
||||
if (leafState === connectivityState.IDLE && !firstIdleChild) {
|
||||
firstIdleChild = leaf;
|
||||
}
|
||||
}
|
||||
if (firstIdleChild) {
|
||||
firstIdleChild.startConnecting();
|
||||
}
|
||||
}
|
||||
|
||||
private calculateAndUpdateState() {
|
||||
|
|
Loading…
Reference in New Issue