diff --git a/lib/internal/cluster/primary.js b/lib/internal/cluster/primary.js index 107ab258a47e04..630704da8fe614 100644 --- a/lib/internal/cluster/primary.js +++ b/lib/internal/cluster/primary.js @@ -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); };