Skip to content

Commit

Permalink
cluster: remove use of bind() in destroy()
Browse files Browse the repository at this point in the history
This commit replaces process.exit.bind() with an arrow function
in Worker.prototype.destroy().

PR-URL: #6502
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
yorkie authored and Fishrock123 committed May 4, 2016
1 parent 08e0884 commit 1330496
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -684,10 +684,12 @@ function workerInit() {

Worker.prototype.destroy = function() {
this.exitedAfterDisconnect = true;
if (!this.isConnected()) process.exit(0);
var exit = process.exit.bind(null, 0);
send({ act: 'exitedAfterDisconnect' }, () => process.disconnect());
process.once('disconnect', exit);
if (!this.isConnected()) {
process.exit(0);
} else {
send({ act: 'exitedAfterDisconnect' }, () => process.disconnect());
process.once('disconnect', () => process.exit(0));
}
};

function send(message, cb) {
Expand Down

0 comments on commit 1330496

Please sign in to comment.