grpc-js: pick-first: fix bad state transition when reconnecting connected LB

This commit is contained in:
murgatroid99 2019-10-08 16:35:42 -07:00
parent af5589be5a
commit ee72cd440f
2 changed files with 10 additions and 10 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@grpc/grpc-js",
"version": "0.6.6",
"version": "0.6.7",
"description": "gRPC Library for Node - pure JS implementation",
"homepage": "https://grpc.io/",
"repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",

View File

@ -312,10 +312,6 @@ export class PickFirstLoadBalancer implements LoadBalancer {
subchannel.addConnectivityStateListener(this.subchannelStateListener);
if (subchannel.getConnectivityState() === ConnectivityState.READY) {
this.pickSubchannel(subchannel);
this.updateState(
ConnectivityState.READY,
new PickFirstPicker(subchannel)
);
this.resetSubchannelList();
return;
}
@ -327,16 +323,20 @@ export class PickFirstLoadBalancer implements LoadBalancer {
subchannelState === ConnectivityState.CONNECTING
) {
this.startConnecting(index);
if (this.currentPick === null) {
this.updateState(ConnectivityState.CONNECTING, new QueuePicker(this));
}
return;
}
}
// If the code reaches this point, every subchannel must be in TRANSIENT_FAILURE
if (this.currentPick === null) {
this.updateState(
ConnectivityState.TRANSIENT_FAILURE,
new UnavailablePicker()
);
}
}
updateAddressList(
addressList: string[],