X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fselection-strategies%2Finterleaved-weighted-round-robin-worker-choice-strategy.ts;h=3942bb6ed99961f986e1286ab20b31baf2a00eb5;hb=8166b5b31ebb2d15bbdc112f1a86d3774fe21294;hp=fe4b48833ee98459880878c91a82204cac8408f5;hpb=67f3f2d6cb8f915ec71f81c4533ab80a6c6a6f0f;p=poolifier.git diff --git a/src/pools/selection-strategies/interleaved-weighted-round-robin-worker-choice-strategy.ts b/src/pools/selection-strategies/interleaved-weighted-round-robin-worker-choice-strategy.ts index fe4b4883..3942bb6e 100644 --- a/src/pools/selection-strategies/interleaved-weighted-round-robin-worker-choice-strategy.ts +++ b/src/pools/selection-strategies/interleaved-weighted-round-robin-worker-choice-strategy.ts @@ -4,8 +4,8 @@ import { DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS } from '../../utils.js' import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy.js' import type { IWorkerChoiceStrategy, - InternalWorkerChoiceStrategyOptions, - TaskStatisticsRequirements + TaskStatisticsRequirements, + WorkerChoiceStrategyOptions } from './selection-strategies-types.js' /** @@ -53,7 +53,7 @@ export class InterleavedWeightedRoundRobinWorkerChoiceStrategy< /** @inheritDoc */ public constructor ( pool: IPool, - opts: InternalWorkerChoiceStrategyOptions + opts?: WorkerChoiceStrategyOptions ) { super(pool, opts) this.setTaskStatisticsRequirements(this.opts) @@ -95,7 +95,7 @@ export class InterleavedWeightedRoundRobinWorkerChoiceStrategy< this.workerNodeVirtualTaskRunTime = 0 } // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const workerWeight = this.opts.weights![workerNodeKey]! + const workerWeight = this.opts!.weights![workerNodeKey]! if ( this.isWorkerNodeReady(workerNodeKey) && workerWeight >= this.roundWeights[roundIndex] && @@ -149,7 +149,7 @@ export class InterleavedWeightedRoundRobinWorkerChoiceStrategy< } /** @inheritDoc */ - public setOptions (opts: InternalWorkerChoiceStrategyOptions): void { + public setOptions (opts: WorkerChoiceStrategyOptions | undefined): void { super.setOptions(opts) this.roundWeights = this.getRoundWeights() } @@ -158,7 +158,7 @@ export class InterleavedWeightedRoundRobinWorkerChoiceStrategy< return [ ...new Set( // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - Object.values(this.opts.weights!) + Object.values(this.opts!.weights!) .slice() .sort((a, b) => a - b) )