Skip to content
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

doc,lib: correct child.send() return value docs #3518

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions doc/api/child_process.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ See `kill(2)`
* `message` {Object}
* `sendHandle` {Handle object}
* `callback` {Function}
* Return: Boolean

When using [`child_process.fork()`](#child_process_child_process_fork_modulepath_args_options) you can write to the child using
`child.send(message[, sendHandle][, callback])` and messages are received by
Expand Down Expand Up @@ -266,10 +265,6 @@ argument: `null` on success, or an `Error` object on failure.
`child.send()` emits an `'error'` event if no callback was given and the message
cannot be sent, for example because the child process has already exited.

Returns `true` under normal circumstances or `false` when the backlog of
unsent messages exceeds a threshold that makes it unwise to send more.
Use the callback mechanism to implement flow control.

#### Example: sending server object

Here is an example of sending a server:
Expand Down
1 change: 0 additions & 1 deletion doc/api/cluster.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,6 @@ exit, the master may choose not to respawn a worker based on this value.
* `message` {Object}
* `sendHandle` {Handle object}
* `callback` {Function}
* Return: Boolean

Send a message to a worker or master, optionally with a handle.

Expand Down
3 changes: 0 additions & 3 deletions lib/internal/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -610,9 +610,6 @@ function setupChannel(target, channel) {
this.emit('error', ex); // FIXME(bnoordhuis) Defer to next tick.
}
}

/* If the master is > 2 read() calls behind, please stop sending. */
return channel.writeQueueSize < (65536 * 2);
};

// connected will be set to false immediately when a disconnect() is
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a good change. I remember this was introduced deliberately because unbound queue growth was a real problem with some applications.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's currently an unused value returned from _send() and swallowed by send() and has been since 0.12.0. The last time end users were able to get a boolean returned from send() was 0.10.40. I'm not arguing that you're wrong. I'm just providing additional info/context in case that changes your estimation of the code's importance. (I'm guessing it does not and I certainly value your judgment on it more than my own. You have internalized a ton of historical context I am oblivious to.)

Expand Down