GeezerVison is showing github.com — Either Cluster API doc or Cluster event 'message' argument is wrong · Issue #5126 · nodejs/node
Either Cluster API doc or Cluster event 'message' argument is wrong #5126
Labels
clusterIssues and PRs related to the cluster subsystem.docIssues and PRs related to Node.js documentation. Activity
added
clusterIssues and PRs related to the cluster subsystem. docIssues and PRs related to Node.js documentation. on Feb 6, 2016mscdex commented on Feb 6, 2016
bennosom commented on Feb 7, 2016
Yes, I agree with you. The master should have two arguments, but it has not:
var cluster = require('cluster');
if (cluster.isMaster) {
cluster.fork();
cluster.on('message', (worker, message) => {
console.log(worker, message); // <-- prints: hello undefined
});
} else {
process.send('hello');
}
I would expect the worker object as first argument as mentioned in the docs (see https://nodejs.org/dist/latest-v5.x/docs/api/cluster.html#cluster_event_message_1).
bnoordhuis commented on Feb 7, 2016
sam-github commented on Feb 18, 2016
I'm sorry, yes, it was an oversight, the intention was to emit the worker as the first argument, consistent with the other events on master.
bnoordhuis commented on Feb 22, 2016
Metadata
Metadata
clusterIssues and PRs related to the cluster subsystem.docIssues and PRs related to Node.js documentation. Development
No branches or pull requestsIssue actions