Skip to content

Commit a4ff2ac

Browse files
ehsankhfrmarco-ippolito
authored andcommitted
lib: improve cluster/primary code
PR-URL: #53756 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
1 parent 993bb3b commit a4ff2ac

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/internal/cluster/primary.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -221,12 +221,12 @@ function emitForkNT(worker) {
221221
}
222222

223223
cluster.disconnect = function(cb) {
224-
const workers = ObjectKeys(cluster.workers);
224+
const workers = ObjectValues(cluster.workers);
225225

226226
if (workers.length === 0) {
227227
process.nextTick(() => intercom.emit('disconnect'));
228228
} else {
229-
for (const worker of ObjectValues(cluster.workers)) {
229+
for (const worker of workers) {
230230
if (worker.isConnected()) {
231231
worker.disconnect();
232232
}
@@ -358,8 +358,6 @@ Worker.prototype.disconnect = function() {
358358
};
359359

360360
Worker.prototype.destroy = function(signo) {
361-
const proc = this.process;
362361
const signal = signo || 'SIGTERM';
363-
364-
proc.kill(signal);
362+
this.process.kill(signal);
365363
};

0 commit comments

Comments
 (0)