Skip to content

Commit

Permalink
remove double decrement counters
Browse files Browse the repository at this point in the history
  • Loading branch information
NourAlharithi committed Nov 15, 2023
1 parent 0a5c117 commit c53f5d6
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions src/wsConnectionManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,6 @@ async function main() {

// Handle disconnection
ws.on('close', () => {
wsConnectionsGauge.dec();

// Clear any existing intervals and timeouts
clearInterval(pingIntervalId);
clearTimeout(pongTimeoutId);
Expand All @@ -167,16 +165,11 @@ async function main() {
subscribedChannels.delete(channel);
}
});
});

ws.on('disconnect', () => {
console.log('Client disconnected');
wsConnectionsGauge.dec();
});

ws.on('error', (error) => {
console.error('Socket error:', error);
wsConnectionsGauge.dec();
});
});

Expand Down

0 comments on commit c53f5d6

Please sign in to comment.