From: Jérôme Benoit Date: Wed, 5 Apr 2023 12:03:41 +0000 (+0200) Subject: perf: optimize a pool type test X-Git-Tag: v2.4.1~1 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=ccd49f039d24ec1590b2b32ff1738c80fae743e5;p=poolifier.git perf: optimize a pool type test Signed-off-by: Jérôme Benoit --- diff --git a/src/pools/selection-strategies/worker-choice-strategy-context.ts b/src/pools/selection-strategies/worker-choice-strategy-context.ts index 3d122f02..8041e2f6 100644 --- a/src/pools/selection-strategies/worker-choice-strategy-context.ts +++ b/src/pools/selection-strategies/worker-choice-strategy-context.ts @@ -1,5 +1,4 @@ import type { IPoolInternal } from '../pool-internal' -import { PoolType } from '../pool-internal' import type { IPoolWorker } from '../pool-worker' import type { IWorkerChoiceStrategy, @@ -70,7 +69,7 @@ export class WorkerChoiceStrategyContext< */ public execute (): number { if ( - this.pool.type === PoolType.DYNAMIC && + this.workerChoiceStrategy.isDynamicPool && !this.pool.full && this.pool.findFreeWorkerKey() === -1 ) {