grpc-js: Cancel and don't start idle timer on shutdown

This commit is contained in:
Michael Lumish 2023-10-27 10:14:58 -07:00
parent 845abcaeb2
commit 446f139b37
2 changed files with 5 additions and 2 deletions

View File

@ -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",

View File

@ -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);
}