Skip to main content
Worker.prototype.exitedAfterDisconnect - node__cluster.d.ts - Node documentation
property Worker.prototype.exitedAfterDisconnect

Usage in Deno

```typescript import { Worker } from "node:node__cluster.d.ts"; ```
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 voluntary and accidental exit, the primary may choose not to respawn a worker based on this value. ```js cluster.on('exit', (worker, code, signal) => { if (worker.exitedAfterDisconnect === true) { console.log('Oh, it was just voluntary – no need to worry'); } }); // kill worker worker.kill(); ```

Type

boolean