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=a0ba25838dc524ea678c97701e20ac7aa1f7b413;hpb=4eb9e75a6d47a08541d38b70505e5ba1126aa2f1;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 a0ba2583..e1332b85 100644 --- a/src/pools/selection-strategies/worker-choice-strategy-context.ts +++ b/src/pools/selection-strategies/worker-choice-strategy-context.ts @@ -9,6 +9,7 @@ import { LeastEluWorkerChoiceStrategy } from './least-elu-worker-choice-strategy import { RoundRobinWorkerChoiceStrategy } from './round-robin-worker-choice-strategy' import type { IWorkerChoiceStrategy, + StrategyPolicy, TaskStatisticsRequirements, WorkerChoiceStrategy, WorkerChoiceStrategyOptions @@ -104,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. *