From 446f139b37c6d446dd4d322043747018b760d80e Mon Sep 17 00:00:00 2001 From: Michael Lumish Date: Fri, 27 Oct 2023 10:14:58 -0700 Subject: [PATCH] grpc-js: Cancel and don't start idle timer on shutdown --- packages/grpc-js/package.json | 2 +- packages/grpc-js/src/internal-channel.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/grpc-js/package.json b/packages/grpc-js/package.json index 29e4b584..6627b010 100644 --- a/packages/grpc-js/package.json +++ b/packages/grpc-js/package.json @@ -1,6 +1,6 @@ { "name": "@grpc/grpc-js", - "version": "1.9.7", + "version": "1.9.8", "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 0ed189c0..f36849ef 100644 --- a/packages/grpc-js/src/internal-channel.ts +++ b/packages/grpc-js/src/internal-channel.ts @@ -554,7 +554,7 @@ export class InternalChannel { } private maybeStartIdleTimer() { - if (this.callCount === 0) { + if (this.connectivityState !== ConnectivityState.SHUTDOWN && this.callCount === 0) { this.idleTimer = setTimeout(() => { this.trace( 'Idle timer triggered after ' + @@ -706,6 +706,9 @@ export class InternalChannel { this.resolvingLoadBalancer.destroy(); this.updateState(ConnectivityState.SHUTDOWN); clearInterval(this.callRefTimer); + if (this.idleTimer) { + clearTimeout(this.idleTimer); + } if (this.channelzEnabled) { unregisterChannelzRef(this.channelzRef); }