Answer the question
In order to leave comments, you need to log in
How to understand the logic of this code and the cluster module?
I started to get acquainted with the cluster module, came across an article on Habré . In it, the author shares his code , which, according to him, will balance the loads. I don't understand line 62 in this code:
cluster.on('listening', stopNextWorker);
function stopNextWorker() {
var i = workersToStop.pop(); //workersToStop - массив воркеров, ожидающих рестарта
var worker = cluster.workers[i];
if (worker) stopWorker(worker); //в stopWorker просто выполняется worker.disconnect();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question