X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fselection-strategies%2Fabstract-worker-choice-strategy.ts;h=77b44f6e344547154a0091ca8f17a82bdf1a7cb2;hb=010d7020b316c0dd9a7a95a3ae1cba074ab2303e;hp=fd9cf1fb8b3f0499ed8c7615e805c1fc4ebffa31;hpb=c4855468bc26a7ee37d2c8ef34bb1ac864448e77;p=poolifier.git diff --git a/src/pools/selection-strategies/abstract-worker-choice-strategy.ts b/src/pools/selection-strategies/abstract-worker-choice-strategy.ts index fd9cf1fb..77b44f6e 100644 --- a/src/pools/selection-strategies/abstract-worker-choice-strategy.ts +++ b/src/pools/selection-strategies/abstract-worker-choice-strategy.ts @@ -12,7 +12,7 @@ import type { * * @typeParam Worker - Type of worker which manages the strategy. * @typeParam Data - Type of data sent to the worker. This can only be serializable data. - * @typeParam Response - Type of response of execution. This can only be serializable data. + * @typeParam Response - Type of execution response. This can only be serializable data. */ export abstract class AbstractWorkerChoiceStrategy< Worker extends IWorker, @@ -38,14 +38,14 @@ export abstract class AbstractWorkerChoiceStrategy< protected readonly pool: IPool, protected readonly opts: WorkerChoiceStrategyOptions = DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS ) { - this.checkOptions(this.opts) this.isDynamicPool = this.pool.type === PoolType.DYNAMIC this.choose.bind(this) } - private checkOptions (opts: WorkerChoiceStrategyOptions): void { + protected checkOptions (opts: WorkerChoiceStrategyOptions): void { if (this.requiredStatistics.avgRunTime && opts.medRunTime === true) { - this.requiredStatistics.medRunTime = true + this.requiredStatistics.avgRunTime = false + this.requiredStatistics.medRunTime = opts.medRunTime as boolean } }