remove double decrement counters

This commit is contained in:
Nour Alharithi
2023-11-15 11:05:17 -08:00
parent 0a5c11713b
commit c53f5d6672

View File

@@ -155,8 +155,6 @@ async function main() {
// Handle disconnection
ws.on('close', () => {
wsConnectionsGauge.dec();
// Clear any existing intervals and timeouts
clearInterval(pingIntervalId);
clearTimeout(pongTimeoutId);
@@ -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();
});
});