mirror of https://github.com/grpc/grpc-node.git
Merge pull request #2322 from murgatroid99/grpc-js_transport_session_ref
grpc-js: Reference session in transport when there are active calls
This commit is contained in:
commit
a9f87fcc3c
|
@ -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",
|
||||
|
|
|
@ -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);
|
||||
|
@ -418,6 +420,7 @@ class Http2Transport implements Transport {
|
|||
},
|
||||
onCallEnd: status => {
|
||||
subchannelCallStatsTracker.onCallEnd?.(status);
|
||||
this.removeActiveCall(call);
|
||||
},
|
||||
onStreamEnd: success => {
|
||||
if (success) {
|
||||
|
@ -425,7 +428,6 @@ class Http2Transport implements Transport {
|
|||
} else {
|
||||
this.streamTracker.addCallFailed();
|
||||
}
|
||||
this.removeActiveCall(call);
|
||||
subchannelCallStatsTracker.onStreamEnd?.(success);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue