Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

watcher: don't restart worker on exit code #326

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions watcher/src/workers/supervisor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ function spawnWorker(data: WorkerData) {

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

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