Skip to content

Commit 58b6ae8

Browse files
committed
fix(pyth-lazer-sdk): clear timeout on shutdown
1 parent b5510ea commit 58b6ae8

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lazer/sdk/js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pythnetwork/pyth-lazer-sdk",
3-
"version": "0.3.0",
3+
"version": "0.3.1",
44
"description": "Pyth Lazer SDK",
55
"publishConfig": {
66
"access": "public"

lazer/sdk/js/src/socket/websocket-pool.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export class WebSocketPool {
1414
private messageListeners: ((event: WebSocket.Data) => void)[];
1515
private allConnectionsDownListeners: (() => void)[];
1616
private wasAllDown = true;
17+
private checkConnectionStatesInterval: NodeJS.Timeout;
1718

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

2526
// Start monitoring connection states
26-
setInterval(() => {
27+
this.checkConnectionStatesInterval = setInterval(() => {
2728
this.checkConnectionStates();
2829
}, 100);
2930
}
@@ -218,5 +219,6 @@ export class WebSocketPool {
218219
this.subscriptions.clear();
219220
this.messageListeners = [];
220221
this.allConnectionsDownListeners = [];
222+
clearInterval(this.checkConnectionStatesInterval);
221223
}
222224
}

0 commit comments

Comments
 (0)