grpc-js: Fix tracking of active calls in transport

This commit is contained in:
Michael Lumish 2023-01-25 11:52:24 -08:00
parent f29e99d0c6
commit 0d177a818f
1 changed files with 8 additions and 4 deletions

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