Skip to content

Commit

Permalink
Merge pull request #18 from trailbehind/wake-the-dead
Browse files Browse the repository at this point in the history
Fork a new worker process when one dies
  • Loading branch information
Jesse Crocker committed Dec 19, 2019
2 parents 5b0cd02 + c98d773 commit 633701f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bin/squirrel.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ function run(opts) {
}

cluster.on("exit", (worker, code, signal) => {
console.log(`worker ${worker.process.pid} died`);
// Restart the worker
var worker = cluster.fork();
console.log(`worker ${worker.process.pid} died and has been replaced by ${worker.process.pid}`);
});
} else {
console.log("Starting worker");
Expand Down

0 comments on commit 633701f

Please sign in to comment.