Skip to content

Commit

Permalink
grpc-js: Fix tracking of active calls in transport
Browse files Browse the repository at this point in the history
  • Loading branch information
murgatroid99 committed Jan 25, 2023
1 parent f29e99d commit 0d177a8
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/grpc-js/src/transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,16 +354,20 @@ class Http2Transport implements Transport {

private removeActiveCall(call: Http2SubchannelCall) {
this.activeCalls.delete(call);
if (this.activeCalls.size === 0 && !this.keepaliveWithoutCalls) {
if (this.activeCalls.size === 0) {
this.session.unref();
this.stopKeepalivePings();
if (!this.keepaliveWithoutCalls) {
this.stopKeepalivePings();
}
}
}

private addActiveCall(call: Http2SubchannelCall) {
if (this.activeCalls.size === 0 && !this.keepaliveWithoutCalls) {
if (this.activeCalls.size === 0) {
this.session.ref();
this.startKeepalivePings();
if (!this.keepaliveWithoutCalls) {
this.startKeepalivePings();
}
}
this.activeCalls.add(call);
}
Expand Down

0 comments on commit 0d177a8

Please sign in to comment.