◐ Shell
clean mode source ↗

lib: improve cluster/primary code · nodejs/node@a4ff2ac

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

};