mirror of https://github.com/grpc/grpc-node.git
grpc-js: pick-first: fix bad state transition when reconnecting connected LB
This commit is contained in:
parent
af5589be5a
commit
ee72cd440f
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@grpc/grpc-js",
|
"name": "@grpc/grpc-js",
|
||||||
"version": "0.6.6",
|
"version": "0.6.7",
|
||||||
"description": "gRPC Library for Node - pure JS implementation",
|
"description": "gRPC Library for Node - pure JS implementation",
|
||||||
"homepage": "https://grpc.io/",
|
"homepage": "https://grpc.io/",
|
||||||
"repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",
|
"repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",
|
||||||
|
|
|
@ -312,10 +312,6 @@ export class PickFirstLoadBalancer implements LoadBalancer {
|
||||||
subchannel.addConnectivityStateListener(this.subchannelStateListener);
|
subchannel.addConnectivityStateListener(this.subchannelStateListener);
|
||||||
if (subchannel.getConnectivityState() === ConnectivityState.READY) {
|
if (subchannel.getConnectivityState() === ConnectivityState.READY) {
|
||||||
this.pickSubchannel(subchannel);
|
this.pickSubchannel(subchannel);
|
||||||
this.updateState(
|
|
||||||
ConnectivityState.READY,
|
|
||||||
new PickFirstPicker(subchannel)
|
|
||||||
);
|
|
||||||
this.resetSubchannelList();
|
this.resetSubchannelList();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -327,15 +323,19 @@ export class PickFirstLoadBalancer implements LoadBalancer {
|
||||||
subchannelState === ConnectivityState.CONNECTING
|
subchannelState === ConnectivityState.CONNECTING
|
||||||
) {
|
) {
|
||||||
this.startConnecting(index);
|
this.startConnecting(index);
|
||||||
this.updateState(ConnectivityState.CONNECTING, new QueuePicker(this));
|
if (this.currentPick === null) {
|
||||||
|
this.updateState(ConnectivityState.CONNECTING, new QueuePicker(this));
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If the code reaches this point, every subchannel must be in TRANSIENT_FAILURE
|
// If the code reaches this point, every subchannel must be in TRANSIENT_FAILURE
|
||||||
this.updateState(
|
if (this.currentPick === null) {
|
||||||
ConnectivityState.TRANSIENT_FAILURE,
|
this.updateState(
|
||||||
new UnavailablePicker()
|
ConnectivityState.TRANSIENT_FAILURE,
|
||||||
);
|
new UnavailablePicker()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateAddressList(
|
updateAddressList(
|
||||||
|
|
Loading…
Reference in New Issue