-
Notifications
You must be signed in to change notification settings - Fork 29.1k
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: migrate from worker.suicide #3743
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,12 @@ if (cluster.isWorker) { | |
http.Server(function() { | ||
|
||
}).listen(common.PORT, '127.0.0.1'); | ||
const worker = cluster.worker; | ||
assert.strictEqual(worker.exitedAfterDisconnect, worker.suicide); | ||
|
||
cluster.worker.on('disconnect', function() { | ||
assert.strictEqual(cluster.worker.exitedAfterDisconnect, | ||
cluster.worker.suicide); | ||
process.exit(42); | ||
}); | ||
|
||
|
@@ -26,7 +30,7 @@ if (cluster.isWorker) { | |
emitDisconnectInsideWorker: false, | ||
emitExit: false, | ||
state: false, | ||
suicideMode: false, | ||
voluntaryMode: false, | ||
died: false | ||
} | ||
}; | ||
|
@@ -60,7 +64,7 @@ if (cluster.isWorker) { | |
// Check worker events and properties | ||
worker.once('disconnect', function() { | ||
checks.worker.emitDisconnect = true; | ||
checks.worker.suicideMode = worker.suicide; | ||
checks.worker.voluntaryMode = worker.exitedAfterDisconnect; | ||
checks.worker.state = worker.state; | ||
}); | ||
|
||
|
@@ -86,7 +90,7 @@ if (cluster.isWorker) { | |
|
||
// flags | ||
assert.equal(w.state, 'disconnected', 'The state property was not set'); | ||
assert.equal(w.suicideMode, true, 'Suicide mode was not set'); | ||
assert.equal(w.voluntaryMode, true, 'Voluntary exit mode was not set'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file still has There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It'a actually fine there. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah good catch. Fixing now |
||
|
||
// is process alive | ||
assert.ok(w.died, 'The worker did not die'); | ||
|
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.
Not sure if there is a reason to duplicate the
exitedVoluntarily
documentation here, just a link should do it IMO.I don't have a strong opinion on this, though. It would perhaps be better to wait for more opinions here.
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.
It's likely not necessary to duplicate but pulling out the redundant text can be done in a separate PR
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.
/cc @nodejs/collaborators — should we keep this part, or just replace it with the following:
removing all the duplicate text?
Update: ah, sorry, missed the last comment by @jasnell.