diff --git a/packages/grpc-js/src/channel.ts b/packages/grpc-js/src/channel.ts index f046ede9..ceb030a0 100644 --- a/packages/grpc-js/src/channel.ts +++ b/packages/grpc-js/src/channel.ts @@ -289,9 +289,7 @@ export class ChannelImplementation implements Channel { this.resolvingLoadBalancer.destroy(); this.updateState(ConnectivityState.SHUTDOWN); - if (this.subchannelPool !== undefined) { - this.subchannelPool.forceCleanup(); - } + this.subchannelPool.forceCleanup(); } getTarget() { diff --git a/packages/grpc-js/src/subchannel-pool.ts b/packages/grpc-js/src/subchannel-pool.ts index 091ab6ca..16b457d5 100644 --- a/packages/grpc-js/src/subchannel-pool.ts +++ b/packages/grpc-js/src/subchannel-pool.ts @@ -92,7 +92,7 @@ export class SubchannelPool { * Ensure that the cleanup task is spawned. */ ensureCleanupTask(): void { - if (this.global === true && this.cleanupTimer === undefined) { + if (this.global && this.cleanupTimer === undefined) { this.cleanupTimer = setInterval(() => { this.unrefUnusedSubchannels(); }, REF_CHECK_INTERVAL);