Skip to content

Commit

Permalink
ensure that client keepalive timers are always cleared when they trig…
Browse files Browse the repository at this point in the history
…ger. this is a necessary change to fit with having removed keepaliveDisabled boolean. manually inspected test logs for both server.ts and transport.ts to verify both types of keepalives are operating correctly.
  • Loading branch information
davidfiala committed Jun 7, 2024
1 parent 3c5ab22 commit 98cd87f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/grpc-js/src/transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ class Http2Transport implements Transport {
'Sending ping with timeout ' + this.keepaliveTimeoutMs + 'ms'
);
this.keepaliveTimer = setTimeout(() => {
this.keepaliveTimer = null;
this.keepaliveTrace('Ping timeout passed without response');
this.handleDisconnect();
}, this.keepaliveTimeoutMs);
Expand Down Expand Up @@ -471,6 +472,7 @@ class Http2Transport implements Transport {
'Starting keepalive timer for ' + this.keepaliveTimeMs + 'ms'
);
this.keepaliveTimer = setTimeout(() => {
this.keepaliveTimer = null;
this.maybeSendPing();
}, this.keepaliveTimeMs);
this.keepaliveTimer.unref?.();
Expand Down

0 comments on commit 98cd87f

Please sign in to comment.