mirror of https://github.com/grpc/grpc-node.git
Merge pull request #1068 from murgatroid99/grpc-js_pick_first_state_change
grpc-js: pick first: remove reference and go idle after disconnect
This commit is contained in:
commit
af5589be5a
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@grpc/grpc-js",
|
"name": "@grpc/grpc-js",
|
||||||
"version": "0.6.5",
|
"version": "0.6.6",
|
||||||
"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",
|
||||||
|
|
|
@ -184,6 +184,7 @@ export class PickFirstLoadBalancer implements LoadBalancer {
|
||||||
newState: ConnectivityState
|
newState: ConnectivityState
|
||||||
) => {
|
) => {
|
||||||
if (newState !== ConnectivityState.READY) {
|
if (newState !== ConnectivityState.READY) {
|
||||||
|
this.currentPick = null;
|
||||||
subchannel.unref();
|
subchannel.unref();
|
||||||
subchannel.removeConnectivityStateListener(
|
subchannel.removeConnectivityStateListener(
|
||||||
this.pickedSubchannelStateListener
|
this.pickedSubchannelStateListener
|
||||||
|
@ -203,8 +204,11 @@ export class PickFirstLoadBalancer implements LoadBalancer {
|
||||||
this.updateState(newLBState, new QueuePicker(this));
|
this.updateState(newLBState, new QueuePicker(this));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.connectToAddressList();
|
/* We don't need to backoff here because this only happens if a
|
||||||
this.channelControlHelper.requestReresolution();
|
* subchannel successfully connects then disconnects, so it will not
|
||||||
|
* create a loop of attempting to connect to an unreachable backend
|
||||||
|
*/
|
||||||
|
this.updateState(ConnectivityState.IDLE, new QueuePicker(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -348,6 +352,7 @@ export class PickFirstLoadBalancer implements LoadBalancer {
|
||||||
subchannel.startConnecting();
|
subchannel.startConnecting();
|
||||||
}
|
}
|
||||||
if (this.currentState === ConnectivityState.IDLE) {
|
if (this.currentState === ConnectivityState.IDLE) {
|
||||||
|
this.channelControlHelper.requestReresolution();
|
||||||
if (this.latestAddressList.length > 0) {
|
if (this.latestAddressList.length > 0) {
|
||||||
this.connectToAddressList();
|
this.connectToAddressList();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue