Skip to content

Commit ba5800d

Browse files
committed
fix: node crashes after computer sleep
1 parent 3dd832d commit ba5800d

File tree

1 file changed

+0
-22
lines changed

1 file changed

+0
-22
lines changed

src-node/node-connector.js

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -105,27 +105,6 @@ const LARGE_DATA_THRESHOLD = 2*1024*1024; // 2MB
105105
let controlSocketMain = null,
106106
largeDataSocketMain = null;
107107

108-
const SOCKET_HEALTH_CHECK_INTERVAL_MS = 3000; // 3 seconds
109-
let healthCheckFailuresCount = 0; // Count of consecutive health check failures
110-
const RETRY_HEALTH_CHECK_MAX_COUNT = 2;
111-
112-
function startOrphanExitDetection() {
113-
setInterval(() => {
114-
if (healthCheckFailuresCount === RETRY_HEALTH_CHECK_MAX_COUNT) {
115-
console.error(`No socket connection for ${healthCheckFailuresCount * SOCKET_HEALTH_CHECK_INTERVAL_MS / 1000} seconds. Exiting due to orphan node process detection.`);
116-
process.exit(1);
117-
}
118-
119-
if (controlSocketMain || largeDataSocketMain) {
120-
// Reset failure count if any socket is connected
121-
healthCheckFailuresCount = 0;
122-
return;
123-
}
124-
console.warn(`No active sockets detected, node will be terminated in ${(RETRY_HEALTH_CHECK_MAX_COUNT-healthCheckFailuresCount)*SOCKET_HEALTH_CHECK_INTERVAL_MS/1000} seconds`);
125-
healthCheckFailuresCount++;
126-
}, SOCKET_HEALTH_CHECK_INTERVAL_MS);
127-
}
128-
129108
const MAX_PENDING_SEND_BUFFER = 10000;
130109
let pendingSendBuffer = [];
131110

@@ -366,7 +345,6 @@ function processWSCommand(ws, metadata, dataBuffer) {
366345
ws.isLargeData = false;
367346
controlSocketMain = ws;
368347
_drainPendingSendBuffer();
369-
startOrphanExitDetection();
370348
return;
371349
case WS_COMMAND.EXEC:
372350
_execNodeConnectorFn(ws, metadata, dataBuffer);

0 commit comments

Comments
 (0)