From a40f6a80489214a61d5292817d00cb3865b9a552 Mon Sep 17 00:00:00 2001 From: jczaplew Date: Wed, 18 Dec 2019 15:26:20 -0600 Subject: [PATCH 1/2] Fork a new worker process when one dies --- bin/squirrel.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/squirrel.js b/bin/squirrel.js index 970a570..071ce67 100755 --- a/bin/squirrel.js +++ b/bin/squirrel.js @@ -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"); From c98d7739178875bbed1579b12646843935b2d0df Mon Sep 17 00:00:00 2001 From: jczaplew Date: Wed, 18 Dec 2019 15:28:28 -0600 Subject: [PATCH 2/2] Fix typo in comment --- bin/squirrel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/squirrel.js b/bin/squirrel.js index 071ce67..6066eca 100755 --- a/bin/squirrel.js +++ b/bin/squirrel.js @@ -71,7 +71,7 @@ function run(opts) { } cluster.on("exit", (worker, code, signal) => { - // Retart the worker + // Restart the worker var worker = cluster.fork(); console.log(`worker ${worker.process.pid} died and has been replaced by ${worker.process.pid}`); });