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

View File

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

View File

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