X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fabstract-pool.ts;h=c3f293e78bc693fba6aea17e36c880968ee58443;hb=c9170223028c20b8e47f6ef43d33cc5b8b68e07e;hp=ff7413dd52f2f24e32b7359ce0f14af6180cca67;hpb=7c0ba92006a5c188738ffc5ff642c51f172df3d6;p=poolifier.git diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index ff7413dd..c3f293e7 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -2,6 +2,7 @@ import type { MessageValue, PromiseWorkerResponseWrapper } from '../utility-types' +import { EMPTY_FUNCTION } from '../utils' import { isKillBehavior, KillBehaviors } from '../worker/worker-options' import type { IPoolInternal } from './pool-internal' import { PoolEmitter, PoolType } from './pool-internal' @@ -11,13 +12,6 @@ import { WorkerChoiceStrategyContext } from './selection-strategies' -/** - * An intentional empty function. - */ -const EMPTY_FUNCTION: () => void = () => { - /* Intentionally empty */ -} - /** * Callback invoked if the worker raised an error. */ @@ -191,7 +185,7 @@ export abstract class AbstractPool< }) return workerCreated }, - opts.workerChoiceStrategy ?? WorkerChoiceStrategies.ROUND_ROBIN + this.opts.workerChoiceStrategy ) } @@ -220,6 +214,8 @@ export abstract class AbstractPool< } private checkPoolOptions (opts: PoolOptions): void { + this.opts.workerChoiceStrategy = + opts.workerChoiceStrategy ?? WorkerChoiceStrategies.ROUND_ROBIN this.opts.enableEvents = opts.enableEvents ?? true }