From 445264e81bd5f5294bea64a0ab396e9808fbece8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 18 Aug 2023 21:17:44 +0200 Subject: [PATCH] docs: improve backPressure event documentation MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- CHANGELOG.md | 2 +- docs/api.md | 3 ++- src/pools/pool.ts | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c61fc49..4e013050 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -- Add back pressure detection on the worker node queue. Event `backPressure` is emitted all worker node queues are full (worker node queue size >= poolMaxSize^2). +- Add back pressure detection on the worker node queue. Event `backPressure` is emitted when all worker node queues are full (worker node queue size >= poolMaxSize^2). - Use back pressure detection in worker choice strategies. - Add worker choice strategies retries mechanism if no worker is eligible. diff --git a/docs/api.md b/docs/api.md index a48f4c54..1848c130 100644 --- a/docs/api.md +++ b/docs/api.md @@ -94,7 +94,8 @@ An object with these properties: Properties: - `concurrency` (optional) - The maximum number of tasks that can be executed concurrently on a worker. It must be a positive integer. - Default: `{ concurrency: 1 }` + + Default: `{ concurrency: 1 }` #### `ThreadPoolOptions extends PoolOptions` diff --git a/src/pools/pool.ts b/src/pools/pool.ts index 427dfd1c..e65cc115 100644 --- a/src/pools/pool.ts +++ b/src/pools/pool.ts @@ -201,7 +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). + * - `'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 /** -- 2.34.1