From: Jérôme Benoit Date: Tue, 11 Jul 2023 19:58:25 +0000 (+0200) Subject: fix: fix pool starting detection X-Git-Tag: v2.6.16~8^2 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=075e51d1065e974cf3080d61d0d9ceedf88313de;p=poolifier.git fix: fix pool starting detection Signed-off-by: Jérôme Benoit --- 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(