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 6d67fbde84
commit 2c3b02a682
No known key found for this signature in database
GPG Key ID: 488D7DCFB5A430D7

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);