Skip to content

Commit

Permalink
fix(pyth-lazer-sdk): clear timeout on shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
keyvankhademi committed Jan 15, 2025
1 parent b5510ea commit 58b6ae8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lazer/sdk/js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pythnetwork/pyth-lazer-sdk",
"version": "0.3.0",
"version": "0.3.1",
"description": "Pyth Lazer SDK",
"publishConfig": {
"access": "public"
Expand Down
4 changes: 3 additions & 1 deletion lazer/sdk/js/src/socket/websocket-pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export class WebSocketPool {
private messageListeners: ((event: WebSocket.Data) => void)[];
private allConnectionsDownListeners: (() => void)[];
private wasAllDown = true;
private checkConnectionStatesInterval: NodeJS.Timeout;

private constructor(private readonly logger: Logger = dummyLogger) {
this.rwsPool = [];
Expand All @@ -23,7 +24,7 @@ export class WebSocketPool {
this.allConnectionsDownListeners = [];

// Start monitoring connection states
setInterval(() => {
this.checkConnectionStatesInterval = setInterval(() => {
this.checkConnectionStates();
}, 100);
}
Expand Down Expand Up @@ -218,5 +219,6 @@ export class WebSocketPool {
this.subscriptions.clear();
this.messageListeners = [];
this.allConnectionsDownListeners = [];
clearInterval(this.checkConnectionStatesInterval);
}
}

0 comments on commit 58b6ae8

Please sign in to comment.