Skip to content

Commit 446f139

Browse files
committed
grpc-js: Cancel and don't start idle timer on shutdown
1 parent 845abca commit 446f139

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

packages/grpc-js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@grpc/grpc-js",
3-
"version": "1.9.7",
3+
"version": "1.9.8",
44
"description": "gRPC Library for Node - pure JS implementation",
55
"homepage": "https://grpc.io/",
66
"repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",

packages/grpc-js/src/internal-channel.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ export class InternalChannel {
554554
}
555555

556556
private maybeStartIdleTimer() {
557-
if (this.callCount === 0) {
557+
if (this.connectivityState !== ConnectivityState.SHUTDOWN && this.callCount === 0) {
558558
this.idleTimer = setTimeout(() => {
559559
this.trace(
560560
'Idle timer triggered after ' +
@@ -706,6 +706,9 @@ export class InternalChannel {
706706
this.resolvingLoadBalancer.destroy();
707707
this.updateState(ConnectivityState.SHUTDOWN);
708708
clearInterval(this.callRefTimer);
709+
if (this.idleTimer) {
710+
clearTimeout(this.idleTimer);
711+
}
709712
if (this.channelzEnabled) {
710713
unregisterChannelzRef(this.channelzRef);
711714
}

0 commit comments

Comments
 (0)