-import EventEmitter from 'node:events'
+import EventEmitterAsyncResource from 'node:events'
import type {
ErrorHandler,
ExitHandler,
/**
* Pool events emitter.
*/
-export class PoolEmitter extends EventEmitter {}
+export class PoolEmitter extends EventEmitterAsyncResource {}
/**
* Enumeration of pool events.
*/
export const PoolEvents = Object.freeze({
full: 'full',
- busy: 'busy'
+ busy: 'busy',
+ error: 'error'
} as const)
/**
* The worker choice strategy options.
*/
workerChoiceStrategyOptions?: WorkerChoiceStrategyOptions
+ /**
+ * Restart worker on error.
+ */
+ restartWorkerOnError?: boolean
/**
* Pool events emission.
*
*
* - `'full'`: Emitted when the pool is dynamic and full.
* - `'busy'`: Emitted when the pool is busy.
+ * - `'error'`: Emitted when an error occurs.
*/
readonly emitter?: PoolEmitter
/**