GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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

New issue
Copy link
New issue
Copy link
Closed
Closed
Either Cluster API doc or Cluster event 'message' argument is wrong#5126
Copy link
Labels
clusterIssues and PRs related to the cluster subsystem.docIssues and PRs related to Node.js documentation.

Description

@bennosom
bennosom
opened on Feb 6, 2016
Issue body actions

https://nodejs.org/dist/latest-v5.x/docs/api/cluster.html#cluster_event_message_1
Cluster event 'message' has two arguments: worker object and message? Really? I will only get one argument - the message.

Env: Windows, 64bit, v5.5.0

Would be nice if there is a worker object, because it makes life easier...

Activity

  1. mscdex
    added
    clusterIssues and PRs related to the cluster subsystem.
    docIssues and PRs related to Node.js documentation.
    on Feb 6, 2016
  2. mscdex commented on Feb 6, 2016

    @mscdex
    mscdex
    on Feb 6, 2016
    Contributor
    More actions

    @bennosom That's for the master. The worker process only has a message argument.

  3. bennosom commented on Feb 7, 2016

    @bennosom
    bennosom
    on Feb 7, 2016
    Author
    More actions

    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).

  4. bnoordhuis commented on Feb 7, 2016

    @bnoordhuis
    bnoordhuis
    on Feb 7, 2016
    Member
    More actions

    The documentation is at odds with the test coverage here.

    @sam-github Is that an oversight in commit 66fc8ca? The intent was to emit the worker as the first argument?

  5. sam-github commented on Feb 18, 2016

    @sam-github
    sam-github
    on Feb 18, 2016
    Contributor
    More actions

    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.

  6. bnoordhuis commented on Feb 22, 2016

    @bnoordhuis
    bnoordhuis
    on Feb 22, 2016
    Member
    More actions

    #5361

  7. bnoordhuis
    closed this as completedin #5361on Feb 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    clusterIssues and PRs related to the cluster subsystem.docIssues and PRs related to Node.js documentation.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.