From 075e51d1065e974cf3080d61d0d9ceedf88313de Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Tue, 11 Jul 2023 21:58:25 +0200 Subject: [PATCH] fix: fix pool starting detection MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/pools/abstract-pool.ts | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index b43d44a5..50ce2026 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -84,6 +84,10 @@ export abstract class AbstractPool< Response > + /** + * Whether the pool is starting. + */ + private readonly starting: boolean /** * The start timestamp of the pool. */ @@ -128,6 +132,7 @@ export abstract class AbstractPool< this.setupHook() + this.starting = true while ( this.workerNodes.reduce( (accumulator, workerNode) => @@ -137,6 +142,7 @@ export abstract class AbstractPool< ) { this.createAndSetupWorker() } + this.starting = false this.startTimestamp = performance.now() } @@ -416,16 +422,6 @@ export abstract class AbstractPool< } } - private get starting (): boolean { - return ( - this.workerNodes.reduce( - (accumulator, workerNode) => - !workerNode.info.dynamic ? accumulator + 1 : accumulator, - 0 - ) < this.minSize - ) - } - private get ready (): boolean { return ( this.workerNodes.reduce( -- 2.34.1