X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fselection-strategies%2Fworker-choice-strategy-context.ts;h=e1332b85f150d30395cff0938371290765032f1f;hb=2c039e4373e86714cdf27e77440b12ee8eb2e4db;hp=f6e132c88514e3012dcf732cb01cde69a4b26410;hpb=87de9ff55a7ad494b9e9500208b9b7319c094ea6;p=poolifier.git diff --git a/src/pools/selection-strategies/worker-choice-strategy-context.ts b/src/pools/selection-strategies/worker-choice-strategy-context.ts index f6e132c8..e1332b85 100644 --- a/src/pools/selection-strategies/worker-choice-strategy-context.ts +++ b/src/pools/selection-strategies/worker-choice-strategy-context.ts @@ -5,9 +5,11 @@ import { FairShareWorkerChoiceStrategy } from './fair-share-worker-choice-strate import { InterleavedWeightedRoundRobinWorkerChoiceStrategy } from './interleaved-weighted-round-robin-worker-choice-strategy' import { LeastBusyWorkerChoiceStrategy } from './least-busy-worker-choice-strategy' import { LeastUsedWorkerChoiceStrategy } from './least-used-worker-choice-strategy' +import { LeastEluWorkerChoiceStrategy } from './least-elu-worker-choice-strategy' import { RoundRobinWorkerChoiceStrategy } from './round-robin-worker-choice-strategy' import type { IWorkerChoiceStrategy, + StrategyPolicy, TaskStatisticsRequirements, WorkerChoiceStrategy, WorkerChoiceStrategyOptions @@ -70,6 +72,13 @@ export class WorkerChoiceStrategyContext< opts ) ], + [ + WorkerChoiceStrategies.LEAST_ELU, + new (LeastEluWorkerChoiceStrategy.bind(this))( + pool, + opts + ) + ], [ WorkerChoiceStrategies.FAIR_SHARE, new (FairShareWorkerChoiceStrategy.bind(this))( @@ -96,6 +105,19 @@ export class WorkerChoiceStrategyContext< ]) } + /** + * Gets the strategy policy in the context. + * + * @returns The strategy policy. + */ + public getStrategyPolicy (): StrategyPolicy { + return ( + this.workerChoiceStrategies.get( + this.workerChoiceStrategy + ) as IWorkerChoiceStrategy + ).strategyPolicy + } + /** * Gets the worker choice strategy task statistics requirements in the context. *