grpc-js: Reference session in transport when there are active calls

This commit is contained in:
Michael Lumish 2023-01-12 09:24:21 -08:00
parent 3db8acb96f
commit b342001b38
2 changed files with 3 additions and 1 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@grpc/grpc-js",
"version": "1.8.3",
"version": "1.8.4",
"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,12 +354,14 @@ class Http2Transport implements Transport {
private removeActiveCall(call: Http2SubchannelCall) {
this.activeCalls.delete(call);
if (this.activeCalls.size === 0 && !this.keepaliveWithoutCalls) {
this.session.unref();
this.stopKeepalivePings();
}
}
private addActiveCall(call: Http2SubchannelCall) {
if (this.activeCalls.size === 0 && !this.keepaliveWithoutCalls) {
this.session.ref();
this.startKeepalivePings();
}
this.activeCalls.add(call);