grpc-js: exitIdle asynchronously in QueuePicker, only act in exitIdle if IDLE

This commit is contained in:
murgatroid99 2019-10-02 15:18:40 -07:00
parent 58345b60f1
commit a23f739e5f
3 changed files with 11 additions and 7 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@grpc/grpc-js",
"version": "0.6.3",
"version": "0.6.4",
"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

@ -113,7 +113,9 @@ export class QueuePicker {
pick(pickArgs: PickArgs): QueuePickResult {
if (!this.calledExitIdle) {
this.loadBalancer.exitIdle();
process.nextTick(() => {
this.loadBalancer.exitIdle();
});
this.calledExitIdle = true;
}
return {

View File

@ -331,14 +331,16 @@ export class ResolvingLoadBalancer implements LoadBalancer {
}
exitIdle() {
this.innerResolver.updateResolution();
if (this.innerLoadBalancer !== null) {
this.innerLoadBalancer.exitIdle();
}
this.channelControlHelper.updateState(
ConnectivityState.CONNECTING,
new QueuePicker(this)
);
if (this.currentState === ConnectivityState.IDLE) {
this.innerResolver.updateResolution();
this.updateState(
ConnectivityState.CONNECTING,
new QueuePicker(this)
);
}
}
updateAddressList(