Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions lib/internal/cluster/primary.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for (const worker of workers) {
if (worker.isConnected()) {
worker.disconnect();
}
Expand Down Expand Up @@ -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);
};