From 0f256a6bb09579148d896fe6fcad3518eabe4cf3 Mon Sep 17 00:00:00 2001 From: abose Date: Mon, 2 Sep 2024 13:17:06 +0530 Subject: [PATCH] fix: node crashes after computer sleep --- src-node/node-connector.js | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/src-node/node-connector.js b/src-node/node-connector.js index 0ae7111813..22129cd3cc 100644 --- a/src-node/node-connector.js +++ b/src-node/node-connector.js @@ -105,27 +105,6 @@ const LARGE_DATA_THRESHOLD = 2*1024*1024; // 2MB let controlSocketMain = null, largeDataSocketMain = null; -const SOCKET_HEALTH_CHECK_INTERVAL_MS = 3000; // 3 seconds -let healthCheckFailuresCount = 0; // Count of consecutive health check failures -const RETRY_HEALTH_CHECK_MAX_COUNT = 2; - -function startOrphanExitDetection() { - setInterval(() => { - if (healthCheckFailuresCount === RETRY_HEALTH_CHECK_MAX_COUNT) { - console.error(`No socket connection for ${healthCheckFailuresCount * SOCKET_HEALTH_CHECK_INTERVAL_MS / 1000} seconds. Exiting due to orphan node process detection.`); - process.exit(1); - } - - if (controlSocketMain || largeDataSocketMain) { - // Reset failure count if any socket is connected - healthCheckFailuresCount = 0; - return; - } - console.warn(`No active sockets detected, node will be terminated in ${(RETRY_HEALTH_CHECK_MAX_COUNT-healthCheckFailuresCount)*SOCKET_HEALTH_CHECK_INTERVAL_MS/1000} seconds`); - healthCheckFailuresCount++; - }, SOCKET_HEALTH_CHECK_INTERVAL_MS); -} - const MAX_PENDING_SEND_BUFFER = 10000; let pendingSendBuffer = []; @@ -366,7 +345,6 @@ function processWSCommand(ws, metadata, dataBuffer) { ws.isLargeData = false; controlSocketMain = ws; _drainPendingSendBuffer(); - startOrphanExitDetection(); return; case WS_COMMAND.EXEC: _execNodeConnectorFn(ws, metadata, dataBuffer);