File tree 2 files changed +0
-48
lines changed
2 files changed +0
-48
lines changed Original file line number Diff line number Diff line change @@ -451,40 +451,6 @@ if (cluster.isMaster) {
451
451
}
452
452
```
453
453
454
- ### worker.suicide
455
- <!-- YAML
456
- added: v0.7.0
457
- deprecated: v6.0.0
458
- changes:
459
- - version: v7.0.0
460
- pr-url: https://github.com/nodejs/node/pull/3747
461
- description: Accessing this property will now emit a deprecation warning.
462
- -->
463
-
464
- > Stability: 0 - Deprecated: Use [ ` worker.exitedAfterDisconnect ` ] [ ] instead.
465
-
466
- An alias to [ ` worker.exitedAfterDisconnect ` ] [ ] .
467
-
468
- Set by calling ` .kill() ` or ` .disconnect() ` . Until then, it is ` undefined ` .
469
-
470
- The boolean ` worker.suicide ` is used to distinguish between voluntary
471
- and accidental exit, the master may choose not to respawn a worker based on
472
- this value.
473
-
474
- ``` js
475
- cluster .on (' exit' , (worker , code , signal ) => {
476
- if (worker .suicide === true ) {
477
- console .log (' Oh, it was just voluntary – no need to worry' );
478
- }
479
- });
480
-
481
- // kill worker
482
- worker .kill ();
483
- ```
484
-
485
- This API only exists for backwards compatibility and will be removed in the
486
- future.
487
-
488
454
## Event: 'disconnect'
489
455
<!-- YAML
490
456
added: v0.7.9
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
const EventEmitter = require ( 'events' ) ;
3
- const internalUtil = require ( 'internal/util' ) ;
4
3
const util = require ( 'util' ) ;
5
- const defineProperty = Object . defineProperty ;
6
- const suicideDeprecationMessage =
7
- 'worker.suicide is deprecated. Please use worker.exitedAfterDisconnect.' ;
8
4
9
5
module . exports = Worker ;
10
6
@@ -20,16 +16,6 @@ function Worker(options) {
20
16
21
17
this . exitedAfterDisconnect = undefined ;
22
18
23
- defineProperty ( this , 'suicide' , {
24
- get : internalUtil . deprecate (
25
- ( ) => this . exitedAfterDisconnect ,
26
- suicideDeprecationMessage , 'DEP0007' ) ,
27
- set : internalUtil . deprecate (
28
- ( val ) => { this . exitedAfterDisconnect = val ; } ,
29
- suicideDeprecationMessage , 'DEP0007' ) ,
30
- enumerable : true
31
- } ) ;
32
-
33
19
this . state = options . state || 'none' ;
34
20
this . id = options . id | 0 ;
35
21
You can’t perform that action at this time.
0 commit comments