X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fselection-strategies%2Fabstract-worker-choice-strategy.ts;h=cd8736c25e771470871497be2ef2f6933105aaa4;hb=aa1e0433fcfdc47175d6144524bcda57ab2947a1;hp=d3e7e385192f23e502a6fb5ce9afb1a414b07ddf;hpb=7c7bb28936c5de8829dba0794760498077d3ea90;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 d3e7e385..cd8736c2 100644 --- a/src/pools/selection-strategies/abstract-worker-choice-strategy.ts +++ b/src/pools/selection-strategies/abstract-worker-choice-strategy.ts @@ -38,7 +38,7 @@ export abstract class AbstractWorkerChoiceStrategy< /** @inheritDoc */ public readonly strategyPolicy: StrategyPolicy = { dynamicWorkerUsage: false, - dynamicWorkerReady: false + dynamicWorkerReady: true } /** @inheritDoc */ @@ -93,6 +93,11 @@ export abstract class AbstractWorkerChoiceStrategy< } } + protected resetWorkerNodeKeyProperties (): void { + this.nextWorkerNodeKey = 0 + this.previousWorkerNodeKey = 0 + } + /** @inheritDoc */ public abstract reset (): boolean @@ -190,17 +195,17 @@ export abstract class AbstractWorkerChoiceStrategy< } /** - * Assign to nextWorkerNodeKey property the chosen worker node key. + * Check the next worker node eligibility. * - * @param chosenWorkerNodeKey - The chosen worker node key. + * @param chosenNextWorkerNodeKey - The chosen next worker node key. */ - protected assignChosenWorkerNodeKey ( - chosenWorkerNodeKey: number | undefined + protected checkNextWorkerNodeEligibility ( + chosenNextWorkerNodeKey: number | undefined ): void { - if (chosenWorkerNodeKey != null) { - this.nextWorkerNodeKey = chosenWorkerNodeKey - } else { + if (!this.isWorkerNodeEligible(this.nextWorkerNodeKey as number)) { this.nextWorkerNodeKey = undefined + this.previousWorkerNodeKey = + chosenNextWorkerNodeKey ?? this.previousWorkerNodeKey } }