diff options
author | Bar Admoni <bar6020677@gmail.com> | 2022-02-05 02:15:24 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-05 02:15:24 +0300 |
commit | 38007df999430798908f442ea187cd83978515e5 (patch) | |
tree | 400445d4a0c085320bb4f71cb54f81e196202242 /doc/api/cluster.md | |
parent | 6c0eb942b3d1851773fd31adf7b8cd2e6ccb405a (diff) |
cluster: make `kill` to be just `process.kill`
Make `Worker.prototype.kill` to be just `process.kill` without
preforming graceful disconnect beforehand.
Refs: https://github.com/nodejs/node/issues/33715
PR-URL: https://github.com/nodejs/node/pull/34312
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Diffstat (limited to 'doc/api/cluster.md')
-rw-r--r-- | doc/api/cluster.md | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/doc/api/cluster.md b/doc/api/cluster.md index ac199c34a37..0a5af1bcf27 100644 --- a/doc/api/cluster.md +++ b/doc/api/cluster.md @@ -452,8 +452,8 @@ added: v6.0.0 * {boolean} -This property is `true` if the worker exited due to `.kill()` or -`.disconnect()`. If the worker exited any other way, it is `false`. If the +This property is `true` if the worker exited due to `.disconnect()`. +If the worker exited any other way, it is `false`. If the worker has not exited, it is `undefined`. The boolean [`worker.exitedAfterDisconnect`][] allows distinguishing between @@ -577,19 +577,14 @@ added: v0.9.12 * `signal` {string} Name of the kill signal to send to the worker process. **Default:** `'SIGTERM'` -This function will kill the worker. In the primary, it does this -by disconnecting the `worker.process`, and once disconnected, killing -with `signal`. In the worker, it does it by disconnecting the channel, -and then exiting with code `0`. +This function will kill the worker. In the primary worker, it does this by +disconnecting the `worker.process`, and once disconnected, killing with +`signal`. In the worker, it does it by killing the process with `signal`. -Because `kill()` attempts to gracefully disconnect the worker process, it is -susceptible to waiting indefinitely for the disconnect to complete. For example, -if the worker enters an infinite loop, a graceful disconnect will never occur. -If the graceful disconnect behavior is not needed, use `worker.process.kill()`. +The `kill()` function kills the worker process without waiting for a graceful +disconnect, it has the same behavior as `worker.process.kill()`. -Causes `.exitedAfterDisconnect` to be set. - -This method is aliased as `worker.destroy()` for backward compatibility. +This method is aliased as `worker.destroy()` for backwards compatibility. In a worker, `process.kill()` exists, but it is not this function; it is [`kill()`][]. |