File tree Expand file tree Collapse file tree 2 files changed +0
-48
lines changed
Expand file tree Collapse file tree 2 files changed +0
-48
lines changed Original file line number Diff line number Diff line change @@ -451,40 +451,6 @@ if (cluster.isMaster) {
451451}
452452```
453453
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-
488454## Event: 'disconnect'
489455<!-- YAML
490456added: v0.7.9
Original file line number Diff line number Diff line change 11'use strict' ;
22const EventEmitter = require ( 'events' ) ;
3- const internalUtil = require ( 'internal/util' ) ;
43const util = require ( 'util' ) ;
5- const defineProperty = Object . defineProperty ;
6- const suicideDeprecationMessage =
7- 'worker.suicide is deprecated. Please use worker.exitedAfterDisconnect.' ;
84
95module . exports = Worker ;
106
@@ -20,16 +16,6 @@ function Worker(options) {
2016
2117 this . exitedAfterDisconnect = undefined ;
2218
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-
3319 this . state = options . state || 'none' ;
3420 this . id = options . id | 0 ;
3521
You can’t perform that action at this time.
0 commit comments