Skip to content

Commit

Permalink
feat(): safer websocket timer cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagosiebler committed Dec 22, 2023
1 parent a2cc9f5 commit 923b1b0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/websocket-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -808,11 +808,11 @@ export class WebsocketClient extends EventEmitter {

const wasOpen = this.wsStore.isWsOpen(wsKey);

this.getWs(wsKey)?.terminate();
delete this.wsStore.get(wsKey, true).activePongTimer;
this.clearPingTimer(wsKey);
this.clearPongTimer(wsKey);

this.getWs(wsKey)?.terminate();

if (!wasOpen) {
this.logger.info(
`${reason} - socket already closed - trigger immediate reconnect`,
Expand Down

0 comments on commit 923b1b0

Please sign in to comment.