-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cluster: refine worker.destroy function #6502
Conversation
} else { | ||
send({ act: 'exitedAfterDisconnect' }, () => process.disconnect()); | ||
process.once('disconnect', exit); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not eliminate the bind()
altogether?
if (!this.isConnected()) {
process.exit(0);
} else {
send({ act: 'exitedAfterDisconnect' }, () => process.disconnect());
process.once('disconnect', () => process.exit(0));
}
Generally LGTM with a nit and if CI is green: https://ci.nodejs.org/job/node-test-pull-request/2451/ |
@jasnell fixed the nit, could you help me run a new job, thank you :-) |
var exit = process.exit.bind(null, 0); | ||
send({ act: 'exitedAfterDisconnect' }, () => process.disconnect()); | ||
process.once('disconnect', exit); | ||
var code = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you drop this altogether or at least make it const
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cjihrig I choose to use your suggestion 1 because of the consistence with other functions in this module.
send({ act: 'exitedAfterDisconnect' }, () => process.disconnect()); | ||
process.once('disconnect', exit); | ||
if (!this.isConnected()) { | ||
process.exit(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry if there was confusion. In my last comment, I said to either get rid of the var
completely, or make it const
. By get rid of, I meant make the 0
exit code inline, as it was prior to this PR. Without specifying the 0
, this is a very subtle breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, right... good point :-)
@yorkie ... this should be process.exit(0)
and below
The default is |
So why did we introduce the |
LGTM |
New CI: https://ci.nodejs.org/job/node-test-pull-request/2457/ |
Nice. Let's let this sit for another day or so in case anyone else wants to weigh in. |
Ping @cjihrig |
Thanks, landed in 4e905fa. |
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>
:-) thanks for your advices too |
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>
This commit replaces process.exit.bind() with an arrow function in Worker.prototype.destroy(). PR-URL: nodejs#6502 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Added dont-land for lts. Please feel free to let me know if I am incorrect in making this assumption |
Checklist
Affected core subsystem(s)
Description of change
This PR just refines a cluster function and make the duplicated exit functions to be shared, so there is no tests or benchmarks could be provided :-)