Skip to content

Commit d5d658c

Browse files
committed
watcher: don't restart worker on exit code
1 parent 37c1f6c commit d5d658c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

watcher/src/workers/supervisor.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ function spawnWorker(data: WorkerData) {
2929

3030
worker.on('exit', (code) => {
3131
logger.warn(`Worker ${workerName} exited with code ${code}`);
32-
if (code !== 0) {
33-
logger.error(`Restarting worker ${workerName}...`);
34-
spawnWorker(data);
35-
}
32+
// Exit code 0 means the worker exited normally and we should not restart it.
33+
// However, if the supervisor forcibly terminates the worker, the exit code may not be 0
34+
// and we should not restart it because the supervisor will handle it.
35+
// In either case, we should not restart the worker here. Just let the supervisor handle it.
3636
});
3737

3838
workers[workerName] = { worker, data, lastHB: Date.now() };

0 commit comments

Comments
 (0)