I have a few child processes of node, that depends from master. Every process is a program with some asynchronic logic. And i have to terminate this process when all will be done. But process not terminate by himself, cause there some listeners on it. Example:
if (cluster.isMaster) {
for (var i = 0; i < numCPUs; i++) {
let worker = cluster.fork();
worker.send(i);
}
} else {
process.once('message', msg => {
// here some logic
// and after this is done, process have to terminated
console.log(msg);
})
}
But process still working, even i using "once". I had tried to remove all of process listeners, but it still works. How i can terminate it?