Skip to content

Commit

Permalink
fix(pyth-lazer-sdk): clear timeout on shutdown (#2263)
Browse files Browse the repository at this point in the history
* fix(pyth-lazer-sdk): clear timeout on shutdown

* update pnpm in ci
  • Loading branch information
keyvankhademi authored Jan 15, 2025
1 parent b5510ea commit bf18253
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-lazer-solana-contract.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Install Anchor
run: RUSTFLAGS= cargo install --git https://github.com/coral-xyz/anchor --tag v0.30.1 anchor-cli
- name: Install pnpm
run: npm install --global pnpm@9.13.2
run: npm install --global pnpm@9.15.4
- name: Install test dependencies
run: pnpm install --frozen-lockfile
- name: Run tests
Expand Down
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 bf18253

Please sign in to comment.