Skip to content

Commit

Permalink
Merge pull request #2337 from murgatroid99/grpc-js_transport_fix_acti…
Browse files Browse the repository at this point in the history
…ve_call_tracking

grpc-js: Fix tracking of active calls in transport
  • Loading branch information
murgatroid99 committed Jan 25, 2023
2 parents f29e99d + 3efdc7b commit cea545d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/grpc-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@grpc/grpc-js",
"version": "1.8.6",
"version": "1.8.7",
"description": "gRPC Library for Node - pure JS implementation",
"homepage": "https://grpc.io/",
"repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",
Expand Down
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 cea545d

Please sign in to comment.