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)) {
|
if (!(this.currentState === connectivityState.TRANSIENT_FAILURE || this.currentState === connectivityState.CONNECTING)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
let firstIdleChild: LeafLoadBalancer | null = null;
|
||||||
for (const leaf of this.leafMap.values()) {
|
for (const leaf of this.leafMap.values()) {
|
||||||
const leafState = leaf.getConnectivityState();
|
const leafState = leaf.getConnectivityState();
|
||||||
if (leafState === connectivityState.CONNECTING) {
|
if (leafState === connectivityState.CONNECTING) {
|
||||||
|
firstIdleChild = null;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (leafState === connectivityState.IDLE) {
|
if (leafState === connectivityState.IDLE && !firstIdleChild) {
|
||||||
leaf.startConnecting();
|
firstIdleChild = leaf;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (firstIdleChild) {
|
||||||
|
firstIdleChild.startConnecting();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private calculateAndUpdateState() {
|
private calculateAndUpdateState() {
|
||||||
|
|
Loading…
Reference in New Issue