Skip to content

Commit

Permalink
fix: clear the idle timer whenever the websocket closes
Browse files Browse the repository at this point in the history
  • Loading branch information
steveluscher committed Jul 22, 2022
1 parent ce337e0 commit c23f9de
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions web3.js/src/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4577,6 +4577,10 @@ export class Connection {
_wsOnClose(code: number) {
this._rpcWebSocketConnected = false;
this._rpcWebSocketGeneration++;
if (this._rpcWebSocketIdleTimeout) {
clearTimeout(this._rpcWebSocketIdleTimeout);
this._rpcWebSocketIdleTimeout = null;
}
if (this._rpcWebSocketHeartbeat) {
clearInterval(this._rpcWebSocketHeartbeat);
this._rpcWebSocketHeartbeat = null;
Expand Down

0 comments on commit c23f9de

Please sign in to comment.