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 4abe955

Browse filesBrowse files
TrottMylesBorins
authored andcommitted
doc,cluster: use code markup/markdown in headers
Backport-PR-URL: #31108 PR-URL: #31086 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent d56fc6a commit 4abe955
Copy full SHA for 4abe955

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

+31
-31
lines changed
Open diff view settings
Collapse file

‎doc/api/cluster.md‎

Copy file name to clipboardExpand all lines: doc/api/cluster.md
+31-31Lines changed: 31 additions & 31 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ responsibility to manage the worker pool based on its own needs.
111111
Although a primary use case for the `cluster` module is networking, it can
112112
also be used for other use cases requiring worker processes.
113113

114-
## Class: Worker
114+
## Class: `Worker`
115115
<!-- YAML
116116
added: v0.7.0
117117
-->
@@ -122,7 +122,7 @@ A `Worker` object contains all public information and method about a worker.
122122
In the master it can be obtained using `cluster.workers`. In a worker
123123
it can be obtained using `cluster.worker`.
124124

125-
### Event: 'disconnect'
125+
### Event: `'disconnect'`
126126
<!-- YAML
127127
added: v0.7.7
128128
-->
@@ -135,7 +135,7 @@ cluster.fork().on('disconnect', () => {
135135
});
136136
```
137137

138-
### Event: 'error'
138+
### Event: `'error'`
139139
<!-- YAML
140140
added: v0.7.3
141141
-->
@@ -144,7 +144,7 @@ This event is the same as the one provided by [`child_process.fork()`][].
144144

145145
Within a worker, `process.on('error')` may also be used.
146146

147-
### Event: 'exit'
147+
### Event: `'exit'`
148148
<!-- YAML
149149
added: v0.11.2
150150
-->
@@ -168,7 +168,7 @@ worker.on('exit', (code, signal) => {
168168
});
169169
```
170170

171-
### Event: 'listening'
171+
### Event: `'listening'`
172172
<!-- YAML
173173
added: v0.7.0
174174
-->
@@ -185,7 +185,7 @@ cluster.fork().on('listening', (address) => {
185185

186186
It is not emitted in the worker.
187187

188-
### Event: 'message'
188+
### Event: `'message'`
189189
<!-- YAML
190190
added: v0.7.0
191191
-->
@@ -244,7 +244,7 @@ if (cluster.isMaster) {
244244
}
245245
```
246246

247-
### Event: 'online'
247+
### Event: `'online'`
248248
<!-- YAML
249249
added: v0.7.0
250250
-->
@@ -259,7 +259,7 @@ cluster.fork().on('online', () => {
259259

260260
It is not emitted in the worker.
261261

262-
### worker.disconnect()
262+
### `worker.disconnect()`
263263
<!-- YAML
264264
added: v0.7.7
265265
changes:
@@ -329,7 +329,7 @@ if (cluster.isMaster) {
329329
}
330330
```
331331

332-
### worker.exitedAfterDisconnect
332+
### `worker.exitedAfterDisconnect`
333333
<!-- YAML
334334
added: v6.0.0
335335
-->
@@ -355,7 +355,7 @@ cluster.on('exit', (worker, code, signal) => {
355355
worker.kill();
356356
```
357357

358-
### worker.id
358+
### `worker.id`
359359
<!-- YAML
360360
added: v0.8.0
361361
-->
@@ -368,7 +368,7 @@ Each new worker is given its own unique id, this id is stored in the
368368
While a worker is alive, this is the key that indexes it in
369369
`cluster.workers`.
370370

371-
### worker.isConnected()
371+
### `worker.isConnected()`
372372
<!-- YAML
373373
added: v0.11.14
374374
-->
@@ -377,7 +377,7 @@ This function returns `true` if the worker is connected to its master via its
377377
IPC channel, `false` otherwise. A worker is connected to its master after it
378378
has been created. It is disconnected after the `'disconnect'` event is emitted.
379379

380-
### worker.isDead()
380+
### `worker.isDead()`
381381
<!-- YAML
382382
added: v0.11.14
383383
-->
@@ -415,7 +415,7 @@ if (cluster.isMaster) {
415415
}
416416
```
417417

418-
### worker.kill(\[signal='SIGTERM'\])
418+
### `worker.kill([signal='SIGTERM'])`
419419
<!-- YAML
420420
added: v0.9.12
421421
-->
@@ -439,7 +439,7 @@ This method is aliased as `worker.destroy()` for backwards compatibility.
439439
In a worker, `process.kill()` exists, but it is not this function;
440440
it is [`kill()`][].
441441

442-
### worker.process
442+
### `worker.process`
443443
<!-- YAML
444444
added: v0.7.0
445445
-->
@@ -456,7 +456,7 @@ Workers will call `process.exit(0)` if the `'disconnect'` event occurs
456456
on `process` and `.exitedAfterDisconnect` is not `true`. This protects against
457457
accidental disconnection.
458458

459-
### worker.send(message\[, sendHandle\[, options\]\]\[, callback\])
459+
### `worker.send(message[, sendHandle[, options]][, callback])`
460460
<!-- YAML
461461
added: v0.7.0
462462
changes:
@@ -498,7 +498,7 @@ if (cluster.isMaster) {
498498
}
499499
```
500500

501-
## Event: 'disconnect'
501+
## Event: `'disconnect'`
502502
<!-- YAML
503503
added: v0.7.9
504504
-->
@@ -519,7 +519,7 @@ cluster.on('disconnect', (worker) => {
519519
});
520520
```
521521

522-
## Event: 'exit'
522+
## Event: `'exit'`
523523
<!-- YAML
524524
added: v0.7.9
525525
-->
@@ -543,7 +543,7 @@ cluster.on('exit', (worker, code, signal) => {
543543

544544
See [`child_process` event: `'exit'`][].
545545

546-
## Event: 'fork'
546+
## Event: `'fork'`
547547
<!-- YAML
548548
added: v0.7.0
549549
-->
@@ -571,7 +571,7 @@ cluster.on('exit', (worker, code, signal) => {
571571
});
572572
```
573573

574-
## Event: 'listening'
574+
## Event: `'listening'`
575575
<!-- YAML
576576
added: v0.7.0
577577
-->
@@ -602,7 +602,7 @@ The `addressType` is one of:
602602
* `-1` (Unix domain socket)
603603
* `'udp4'` or `'udp6'` (UDP v4 or v6)
604604

605-
## Event: 'message'
605+
## Event: `'message'`
606606
<!-- YAML
607607
added: v2.5.0
608608
changes:
@@ -619,7 +619,7 @@ Emitted when the cluster master receives a message from any worker.
619619

620620
See [`child_process` event: `'message'`][].
621621

622-
## Event: 'online'
622+
## Event: `'online'`
623623
<!-- YAML
624624
added: v0.7.0
625625
-->
@@ -637,7 +637,7 @@ cluster.on('online', (worker) => {
637637
});
638638
```
639639

640-
## Event: 'setup'
640+
## Event: `'setup'`
641641
<!-- YAML
642642
added: v0.7.1
643643
-->
@@ -652,7 +652,7 @@ The `settings` object is the `cluster.settings` object at the time
652652

653653
If accuracy is important, use `cluster.settings`.
654654

655-
## cluster.disconnect(\[callback\])
655+
## `cluster.disconnect([callback])`
656656
<!-- YAML
657657
added: v0.7.7
658658
-->
@@ -670,7 +670,7 @@ finished.
670670

671671
This can only be called from the master process.
672672

673-
## cluster.fork(\[env\])
673+
## `cluster.fork([env])`
674674
<!-- YAML
675675
added: v0.6.0
676676
-->
@@ -682,7 +682,7 @@ Spawn a new worker process.
682682

683683
This can only be called from the master process.
684684

685-
## cluster.isMaster
685+
## `cluster.isMaster`
686686
<!-- YAML
687687
added: v0.8.1
688688
-->
@@ -693,7 +693,7 @@ True if the process is a master. This is determined
693693
by the `process.env.NODE_UNIQUE_ID`. If `process.env.NODE_UNIQUE_ID` is
694694
undefined, then `isMaster` is `true`.
695695

696-
## cluster.isWorker
696+
## `cluster.isWorker`
697697
<!-- YAML
698698
added: v0.6.0
699699
-->
@@ -702,7 +702,7 @@ added: v0.6.0
702702

703703
True if the process is not a master (it is the negation of `cluster.isMaster`).
704704

705-
## cluster.schedulingPolicy
705+
## `cluster.schedulingPolicy`
706706
<!-- YAML
707707
added: v0.11.2
708708
-->
@@ -720,7 +720,7 @@ distribute IOCP handles without incurring a large performance hit.
720720
`NODE_CLUSTER_SCHED_POLICY` environment variable. Valid
721721
values are `'rr'` and `'none'`.
722722

723-
## cluster.settings
723+
## `cluster.settings`
724724
<!-- YAML
725725
added: v0.7.1
726726
changes:
@@ -765,7 +765,7 @@ contain the settings, including the default values.
765765

766766
This object is not intended to be changed or set manually.
767767

768-
## cluster.setupMaster(\[settings\])
768+
## `cluster.setupMaster([settings])`
769769
<!-- YAML
770770
added: v0.7.1
771771
changes:
@@ -805,7 +805,7 @@ cluster.fork(); // http worker
805805

806806
This can only be called from the master process.
807807

808-
## cluster.worker
808+
## `cluster.worker`
809809
<!-- YAML
810810
added: v0.7.0
811811
-->
@@ -826,7 +826,7 @@ if (cluster.isMaster) {
826826
}
827827
```
828828

829-
## cluster.workers
829+
## `cluster.workers`
830830
<!-- YAML
831831
added: v0.7.0
832832
-->

0 commit comments

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