@@ -111,7 +111,7 @@ responsibility to manage the worker pool based on its own needs.
111
111
Although a primary use case for the ` cluster ` module is networking, it can
112
112
also be used for other use cases requiring worker processes.
113
113
114
- ## Class: Worker
114
+ ## Class: ` Worker `
115
115
<!-- YAML
116
116
added: v0.7.0
117
117
-->
@@ -122,7 +122,7 @@ A `Worker` object contains all public information and method about a worker.
122
122
In the master it can be obtained using ` cluster.workers ` . In a worker
123
123
it can be obtained using ` cluster.worker ` .
124
124
125
- ### Event: 'disconnect'
125
+ ### Event: ` 'disconnect' `
126
126
<!-- YAML
127
127
added: v0.7.7
128
128
-->
@@ -135,7 +135,7 @@ cluster.fork().on('disconnect', () => {
135
135
});
136
136
```
137
137
138
- ### Event: 'error'
138
+ ### Event: ` 'error' `
139
139
<!-- YAML
140
140
added: v0.7.3
141
141
-->
@@ -144,7 +144,7 @@ This event is the same as the one provided by [`child_process.fork()`][].
144
144
145
145
Within a worker, ` process.on('error') ` may also be used.
146
146
147
- ### Event: 'exit'
147
+ ### Event: ` 'exit' `
148
148
<!-- YAML
149
149
added: v0.11.2
150
150
-->
@@ -168,7 +168,7 @@ worker.on('exit', (code, signal) => {
168
168
});
169
169
```
170
170
171
- ### Event: 'listening'
171
+ ### Event: ` 'listening' `
172
172
<!-- YAML
173
173
added: v0.7.0
174
174
-->
@@ -185,7 +185,7 @@ cluster.fork().on('listening', (address) => {
185
185
186
186
It is not emitted in the worker.
187
187
188
- ### Event: 'message'
188
+ ### Event: ` 'message' `
189
189
<!-- YAML
190
190
added: v0.7.0
191
191
-->
@@ -244,7 +244,7 @@ if (cluster.isMaster) {
244
244
}
245
245
```
246
246
247
- ### Event: 'online'
247
+ ### Event: ` 'online' `
248
248
<!-- YAML
249
249
added: v0.7.0
250
250
-->
@@ -259,7 +259,7 @@ cluster.fork().on('online', () => {
259
259
260
260
It is not emitted in the worker.
261
261
262
- ### worker.disconnect()
262
+ ### ` worker.disconnect() `
263
263
<!-- YAML
264
264
added: v0.7.7
265
265
changes:
@@ -329,7 +329,7 @@ if (cluster.isMaster) {
329
329
}
330
330
```
331
331
332
- ### worker.exitedAfterDisconnect
332
+ ### ` worker.exitedAfterDisconnect `
333
333
<!-- YAML
334
334
added: v6.0.0
335
335
-->
@@ -355,7 +355,7 @@ cluster.on('exit', (worker, code, signal) => {
355
355
worker .kill ();
356
356
```
357
357
358
- ### worker.id
358
+ ### ` worker.id `
359
359
<!-- YAML
360
360
added: v0.8.0
361
361
-->
@@ -368,7 +368,7 @@ Each new worker is given its own unique id, this id is stored in the
368
368
While a worker is alive, this is the key that indexes it in
369
369
` cluster.workers ` .
370
370
371
- ### worker.isConnected()
371
+ ### ` worker.isConnected() `
372
372
<!-- YAML
373
373
added: v0.11.14
374
374
-->
@@ -377,7 +377,7 @@ This function returns `true` if the worker is connected to its master via its
377
377
IPC channel, ` false ` otherwise. A worker is connected to its master after it
378
378
has been created. It is disconnected after the ` 'disconnect' ` event is emitted.
379
379
380
- ### worker.isDead()
380
+ ### ` worker.isDead() `
381
381
<!-- YAML
382
382
added: v0.11.14
383
383
-->
@@ -415,7 +415,7 @@ if (cluster.isMaster) {
415
415
}
416
416
```
417
417
418
- ### worker.kill(\ [ signal='SIGTERM'\] )
418
+ ### ` worker.kill([signal='SIGTERM']) `
419
419
<!-- YAML
420
420
added: v0.9.12
421
421
-->
@@ -439,7 +439,7 @@ This method is aliased as `worker.destroy()` for backwards compatibility.
439
439
In a worker, ` process.kill() ` exists, but it is not this function;
440
440
it is [ ` kill() ` ] [ ] .
441
441
442
- ### worker.process
442
+ ### ` worker.process `
443
443
<!-- YAML
444
444
added: v0.7.0
445
445
-->
@@ -456,7 +456,7 @@ Workers will call `process.exit(0)` if the `'disconnect'` event occurs
456
456
on ` process ` and ` .exitedAfterDisconnect ` is not ` true ` . This protects against
457
457
accidental disconnection.
458
458
459
- ### worker.send(message\ [ , sendHandle\ [ , options\]\]\ [ , callback\] )
459
+ ### ` worker.send(message[, sendHandle[, options]] [, callback]) `
460
460
<!-- YAML
461
461
added: v0.7.0
462
462
changes:
@@ -498,7 +498,7 @@ if (cluster.isMaster) {
498
498
}
499
499
```
500
500
501
- ## Event: 'disconnect'
501
+ ## Event: ` 'disconnect' `
502
502
<!-- YAML
503
503
added: v0.7.9
504
504
-->
@@ -519,7 +519,7 @@ cluster.on('disconnect', (worker) => {
519
519
});
520
520
```
521
521
522
- ## Event: 'exit'
522
+ ## Event: ` 'exit' `
523
523
<!-- YAML
524
524
added: v0.7.9
525
525
-->
@@ -543,7 +543,7 @@ cluster.on('exit', (worker, code, signal) => {
543
543
544
544
See [ ` child_process ` event: ` 'exit' ` ] [ ] .
545
545
546
- ## Event: 'fork'
546
+ ## Event: ` 'fork' `
547
547
<!-- YAML
548
548
added: v0.7.0
549
549
-->
@@ -571,7 +571,7 @@ cluster.on('exit', (worker, code, signal) => {
571
571
});
572
572
```
573
573
574
- ## Event: 'listening'
574
+ ## Event: ` 'listening' `
575
575
<!-- YAML
576
576
added: v0.7.0
577
577
-->
@@ -602,7 +602,7 @@ The `addressType` is one of:
602
602
* ` -1 ` (Unix domain socket)
603
603
* ` 'udp4' ` or ` 'udp6' ` (UDP v4 or v6)
604
604
605
- ## Event: 'message'
605
+ ## Event: ` 'message' `
606
606
<!-- YAML
607
607
added: v2.5.0
608
608
changes:
@@ -619,7 +619,7 @@ Emitted when the cluster master receives a message from any worker.
619
619
620
620
See [ ` child_process ` event: ` 'message' ` ] [ ] .
621
621
622
- ## Event: 'online'
622
+ ## Event: ` 'online' `
623
623
<!-- YAML
624
624
added: v0.7.0
625
625
-->
@@ -637,7 +637,7 @@ cluster.on('online', (worker) => {
637
637
});
638
638
```
639
639
640
- ## Event: 'setup'
640
+ ## Event: ` 'setup' `
641
641
<!-- YAML
642
642
added: v0.7.1
643
643
-->
@@ -652,7 +652,7 @@ The `settings` object is the `cluster.settings` object at the time
652
652
653
653
If accuracy is important, use ` cluster.settings ` .
654
654
655
- ## cluster.disconnect(\ [ callback\] )
655
+ ## ` cluster.disconnect([callback]) `
656
656
<!-- YAML
657
657
added: v0.7.7
658
658
-->
@@ -670,7 +670,7 @@ finished.
670
670
671
671
This can only be called from the master process.
672
672
673
- ## cluster.fork(\ [ env\] )
673
+ ## ` cluster.fork([env]) `
674
674
<!-- YAML
675
675
added: v0.6.0
676
676
-->
@@ -682,7 +682,7 @@ Spawn a new worker process.
682
682
683
683
This can only be called from the master process.
684
684
685
- ## cluster.isMaster
685
+ ## ` cluster.isMaster `
686
686
<!-- YAML
687
687
added: v0.8.1
688
688
-->
@@ -693,7 +693,7 @@ True if the process is a master. This is determined
693
693
by the ` process.env.NODE_UNIQUE_ID ` . If ` process.env.NODE_UNIQUE_ID ` is
694
694
undefined, then ` isMaster ` is ` true ` .
695
695
696
- ## cluster.isWorker
696
+ ## ` cluster.isWorker `
697
697
<!-- YAML
698
698
added: v0.6.0
699
699
-->
@@ -702,7 +702,7 @@ added: v0.6.0
702
702
703
703
True if the process is not a master (it is the negation of ` cluster.isMaster ` ).
704
704
705
- ## cluster.schedulingPolicy
705
+ ## ` cluster.schedulingPolicy `
706
706
<!-- YAML
707
707
added: v0.11.2
708
708
-->
@@ -720,7 +720,7 @@ distribute IOCP handles without incurring a large performance hit.
720
720
` NODE_CLUSTER_SCHED_POLICY ` environment variable. Valid
721
721
values are ` 'rr' ` and ` 'none' ` .
722
722
723
- ## cluster.settings
723
+ ## ` cluster.settings `
724
724
<!-- YAML
725
725
added: v0.7.1
726
726
changes:
@@ -765,7 +765,7 @@ contain the settings, including the default values.
765
765
766
766
This object is not intended to be changed or set manually.
767
767
768
- ## cluster.setupMaster(\ [ settings\] )
768
+ ## ` cluster.setupMaster([settings]) `
769
769
<!-- YAML
770
770
added: v0.7.1
771
771
changes:
@@ -805,7 +805,7 @@ cluster.fork(); // http worker
805
805
806
806
This can only be called from the master process.
807
807
808
- ## cluster.worker
808
+ ## ` cluster.worker `
809
809
<!-- YAML
810
810
added: v0.7.0
811
811
-->
@@ -826,7 +826,7 @@ if (cluster.isMaster) {
826
826
}
827
827
```
828
828
829
- ## cluster.workers
829
+ ## ` cluster.workers `
830
830
<!-- YAML
831
831
added: v0.7.0
832
832
-->
0 commit comments