Skip to content

Commit 1fcb76e

Browse files
committed
cluster: remove deprecated property
PR-URL: #13702 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent eaaec57 commit 1fcb76e

File tree

2 files changed

+0
-48
lines changed

2 files changed

+0
-48
lines changed

doc/api/cluster.md

-34
Original file line numberDiff line numberDiff 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
490456
added: v0.7.9

lib/internal/cluster/worker.js

-14
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
'use strict';
22
const EventEmitter = require('events');
3-
const internalUtil = require('internal/util');
43
const util = require('util');
5-
const defineProperty = Object.defineProperty;
6-
const suicideDeprecationMessage =
7-
'worker.suicide is deprecated. Please use worker.exitedAfterDisconnect.';
84

95
module.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

0 commit comments

Comments
 (0)