X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fpool.ts;h=e65cc115d2d77c0a0590fa5f936043b16dcb38d2;hb=cb9b167557f9a903021bca1c7aba9fc9b24ae1b1;hp=26ca4c03279ad9969df3940141cf0bade3b815b4;hpb=671d515455c745dc74f4c385fe23683975bfc3df;p=poolifier.git diff --git a/src/pools/pool.ts b/src/pools/pool.ts index 26ca4c03..e65cc115 100644 --- a/src/pools/pool.ts +++ b/src/pools/pool.ts @@ -178,8 +178,18 @@ export interface IPool< readonly info: PoolInfo /** * Pool worker nodes. + * + * @internal */ readonly workerNodes: Array> + /** + * 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. * @@ -191,6 +201,7 @@ export interface IPool< * - '`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 /**