full: 'full',
destroy: 'destroy',
error: 'error',
- taskError: 'taskError'
+ taskError: 'taskError',
+ backPressure: 'backPressure'
} as const)
/**
readonly info: PoolInfo
/**
* Pool worker nodes.
+ *
+ * @internal
*/
readonly workerNodes: Array<IWorkerNode<Worker, Data>>
+ /**
+ * Whether the worker node has back pressure (i.e. its tasks queue is full).
+ *
+ * @param workerNodeKey - The worker node key.
+ * @returns `true` if the worker node has back pressure, `false` otherwise.
+ * @internal
+ */
+ readonly hasWorkerNodeBackPressure: (workerNodeKey: number) => boolean
/**
* Emitter on which events can be listened to.
*
* - '`destroy`': Emitted when the pool is destroyed.
* - `'error'`: Emitted when an uncaught error occurs.
* - `'taskError'`: Emitted when an error occurs while executing a task.
+ * - `'backPressure'`: Emitted when all worker nodes have back pressure (i.e. their tasks queue is full: queue size \>= pool maximum size^2).
*/
readonly emitter?: PoolEmitter
/**