Merge pull request #2337 from murgatroid99/grpc-js_transport_fix_active_call_tracking

grpc-js: Fix tracking of active calls in transport
This commit is contained in:
Michael Lumish 2023-01-25 14:28:45 -08:00 committed by GitHub
commit cea545dd77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View File

@ -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",

View File

@ -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);
}