NodeJS cluster: Delay child process auto restart 10 seconds on exit.

refs #108
This commit is contained in:
softsimon 2020-09-22 04:27:08 +07:00
parent c2288c31e6
commit 9d1dd030af

View File

@ -41,8 +41,8 @@ class Server {
}
cluster.on('exit', (worker, code, signal) => {
console.log(`Mempool Worker #${worker.process.pid} died. Restarting...`, signal || code);
cluster.fork();
console.log(`Mempool Worker #${worker.process.pid} died. Restarting in 10 seconds...`, signal || code);
setTimeout(() => { cluster.fork(); }, 10000);
});
} else {
this.startServer(true);