Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8e7df04

Browse filesBrowse files
tniessenruyadorno
authored andcommitted
doc: remove unadvisable cluster example
Applications should usually keep track of workers themselves to prevent cross-referencing workers from different "groups" that are assigned to separate tasks. Additionally, it is unreasonable to assume that the 'data' event emitted by a socket object will be an integer. While the example works when the argument is a string (or Buffer), it can result in various issues (e.g., when id === '__proto__' since cluster.workers has a non-null prototype). Refs: 5f08c3c PR-URL: #41668 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tierney Cyren <hello@bnb.im>
1 parent 0ee468d commit 8e7df04
Copy full SHA for 8e7df04

File tree

Expand file treeCollapse file tree

1 file changed

+0
-8
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+0
-8
lines changed
Open diff view settings
Collapse file

‎doc/api/cluster.md‎

Copy file name to clipboardExpand all lines: doc/api/cluster.md
-8Lines changed: 0 additions & 8 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1087,14 +1087,6 @@ for (const worker of Object.values(cluster.workers)) {
10871087
}
10881088
```
10891089

1090-
Using the worker's unique id is the easiest way to locate the worker.
1091-
1092-
```js
1093-
socket.on('data', (id) => {
1094-
const worker = cluster.workers[id];
1095-
});
1096-
```
1097-
10981090
[Advanced serialization for `child_process`]: child_process.md#advanced-serialization
10991091
[Child Process module]: child_process.md#child_processforkmodulepath-args-options
11001092
[`.fork()`]: #clusterforkenv

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.