mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
lib: improve cluster/primary code
PR-URL: https://github.com/nodejs/node/pull/53756 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
parent
e8c2acf5de
commit
aca31b8e0f
@ -221,12 +221,12 @@ function emitForkNT(worker) {
|
||||
}
|
||||
|
||||
cluster.disconnect = function(cb) {
|
||||
const workers = ObjectKeys(cluster.workers);
|
||||
const workers = ObjectValues(cluster.workers);
|
||||
|
||||
if (workers.length === 0) {
|
||||
process.nextTick(() => intercom.emit('disconnect'));
|
||||
} else {
|
||||
for (const worker of ObjectValues(cluster.workers)) {
|
||||
for (const worker of workers) {
|
||||
if (worker.isConnected()) {
|
||||
worker.disconnect();
|
||||
}
|
||||
@ -358,8 +358,6 @@ Worker.prototype.disconnect = function() {
|
||||
};
|
||||
|
||||
Worker.prototype.destroy = function(signo) {
|
||||
const proc = this.process;
|
||||
const signal = signo || 'SIGTERM';
|
||||
|
||||
proc.kill(signal);
|
||||
this.process.kill(signal);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user