From 4dfd8c43d73231aa2d1b9e26cc0bdb2ff6525328 Mon Sep 17 00:00:00 2001 From: Michael Lumish Date: Fri, 1 Dec 2023 10:26:49 -0500 Subject: [PATCH] grpc-js: Fix call ref timer handling --- packages/grpc-js/package.json | 2 +- packages/grpc-js/src/internal-channel.ts | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/grpc-js/package.json b/packages/grpc-js/package.json index 465f56fb3..78c404c94 100644 --- a/packages/grpc-js/package.json +++ b/packages/grpc-js/package.json @@ -1,6 +1,6 @@ { "name": "@grpc/grpc-js", - "version": "1.9.12", + "version": "1.9.13", "description": "gRPC Library for Node - pure JS implementation", "homepage": "https://grpc.io/", "repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js", diff --git a/packages/grpc-js/src/internal-channel.ts b/packages/grpc-js/src/internal-channel.ts index f36849ef8..ff3ccb5f9 100644 --- a/packages/grpc-js/src/internal-channel.ts +++ b/packages/grpc-js/src/internal-channel.ts @@ -296,7 +296,9 @@ export class InternalChannel { this.currentPicker = picker; const queueCopy = this.pickQueue.slice(); this.pickQueue = []; - this.callRefTimerUnref(); + if (queueCopy.length > 0) { + this.callRefTimerUnref(); + } for (const call of queueCopy) { call.doPick(); } @@ -349,11 +351,12 @@ export class InternalChannel { process.nextTick(() => { const localQueue = this.configSelectionQueue; this.configSelectionQueue = []; - this.callRefTimerUnref(); + if (localQueue.length > 0) { + this.callRefTimerUnref(); + } for (const call of localQueue) { call.getConfig(); } - this.configSelectionQueue = []; }); }, status => { @@ -380,7 +383,9 @@ export class InternalChannel { } const localQueue = this.configSelectionQueue; this.configSelectionQueue = []; - this.callRefTimerUnref(); + if (localQueue.length > 0) { + this.callRefTimerUnref(); + } for (const call of localQueue) { call.reportResolverError(status); }