Skip to content

Commit

Permalink
Fork a new worker process when one dies
Browse files Browse the repository at this point in the history
  • Loading branch information
jczaplew committed Dec 18, 2019
1 parent 5b0cd02 commit a40f6a8
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`);
// Retart 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 a40f6a8

Please sign in to comment.