fix: (web3.js) clear the idle timer whenever the websocket closes (#26734)

fix: clear the idle timer whenever the websocket closes
This commit is contained in:
Steven Luscher 2022-07-24 21:56:03 -07:00 committed by GitHub
parent f6d5b253fb
commit f4100f621f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -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;