Fix keepalive ping timing, change some trace logs

This commit is contained in:
Michael Lumish 2020-08-27 13:23:07 -07:00
parent 665632f480
commit c83d5a7c4d
1 changed files with 10 additions and 5 deletions

View File

@ -40,6 +40,10 @@ function trace(text: string): void {
logging.trace(LogVerbosity.DEBUG, TRACER_NAME, text); logging.trace(LogVerbosity.DEBUG, TRACER_NAME, text);
} }
function refTrace(text: string): void {
logging.trace(LogVerbosity.DEBUG, 'subchannel_refcount', text);
}
const MIN_CONNECT_TIMEOUT_MS = 20000; const MIN_CONNECT_TIMEOUT_MS = 20000;
const INITIAL_BACKOFF_MS = 1000; const INITIAL_BACKOFF_MS = 1000;
const BACKOFF_MULTIPLIER = 1.6; const BACKOFF_MULTIPLIER = 1.6;
@ -278,7 +282,8 @@ export class Subchannel {
this.keepaliveIntervalId = setInterval(() => { this.keepaliveIntervalId = setInterval(() => {
this.sendPing(); this.sendPing();
}, this.keepaliveTimeMs); }, this.keepaliveTimeMs);
this.sendPing(); /* Don't send a ping immediately because whatever caused us to start
* sending pings should also involve some network activity. */
} }
private stopKeepalivePings() { private stopKeepalivePings() {
@ -584,7 +589,7 @@ export class Subchannel {
} }
callRef() { callRef() {
trace( refTrace(
this.subchannelAddressString + this.subchannelAddressString +
' callRefcount ' + ' callRefcount ' +
this.callRefcount + this.callRefcount +
@ -601,7 +606,7 @@ export class Subchannel {
} }
callUnref() { callUnref() {
trace( refTrace(
this.subchannelAddressString + this.subchannelAddressString +
' callRefcount ' + ' callRefcount ' +
this.callRefcount + this.callRefcount +
@ -619,7 +624,7 @@ export class Subchannel {
} }
ref() { ref() {
trace( refTrace(
this.subchannelAddressString + this.subchannelAddressString +
' refcount ' + ' refcount ' +
this.refcount + this.refcount +
@ -630,7 +635,7 @@ export class Subchannel {
} }
unref() { unref() {
trace( refTrace(
this.subchannelAddressString + this.subchannelAddressString +
' refcount ' + ' refcount ' +
this.refcount + this.refcount +