Merge pull request #2087 from murgatroid99/grpc-js_keepalive_timeout_no_calls

grpc-js: Don't clear ping timeout when still connected
This commit is contained in:
Michael Lumish 2022-04-11 15:27:55 -07:00 committed by GitHub
commit fc54c15909
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -378,6 +378,11 @@ export class Subchannel {
* sending pings should also involve some network activity. */
}
/**
* Stop keepalive pings when terminating a connection. This discards the
* outstanding ping timeout, so it should not be called if the same
* connection will still be used.
*/
private stopKeepalivePings() {
clearInterval(this.keepaliveIntervalId);
clearTimeout(this.keepaliveTimeoutId);
@ -767,7 +772,7 @@ export class Subchannel {
}
this.backoffTimeout.unref();
if (!this.keepaliveWithoutCalls) {
this.stopKeepalivePings();
clearInterval(this.keepaliveIntervalId);
}
this.checkBothRefcounts();
}