Skip to content

Commit 0d177a8

Browse files
committed
grpc-js: Fix tracking of active calls in transport
1 parent f29e99d commit 0d177a8

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

packages/grpc-js/src/transport.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,16 +354,20 @@ class Http2Transport implements Transport {
354354

355355
private removeActiveCall(call: Http2SubchannelCall) {
356356
this.activeCalls.delete(call);
357-
if (this.activeCalls.size === 0 && !this.keepaliveWithoutCalls) {
357+
if (this.activeCalls.size === 0) {
358358
this.session.unref();
359-
this.stopKeepalivePings();
359+
if (!this.keepaliveWithoutCalls) {
360+
this.stopKeepalivePings();
361+
}
360362
}
361363
}
362364

363365
private addActiveCall(call: Http2SubchannelCall) {
364-
if (this.activeCalls.size === 0 && !this.keepaliveWithoutCalls) {
366+
if (this.activeCalls.size === 0) {
365367
this.session.ref();
366-
this.startKeepalivePings();
368+
if (!this.keepaliveWithoutCalls) {
369+
this.startKeepalivePings();
370+
}
367371
}
368372
this.activeCalls.add(call);
369373
}

0 commit comments

Comments
 (0)