X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fselection-strategies%2Fabstract-worker-choice-strategy.ts;h=2fba4e9fbd1a17be10fd9d6a86a6cb574a9ad03b;hb=9fe8fd698590c2494dc6793cfd8c08026fe88a31;hp=cc38d196941e4611af2235a84899cd82ab55c9f0;hpb=0676e5d32c8f8ee5c5b7f5998f4973b0a276460f;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 cc38d196..2fba4e9f 100644 --- a/src/pools/selection-strategies/abstract-worker-choice-strategy.ts +++ b/src/pools/selection-strategies/abstract-worker-choice-strategy.ts @@ -93,6 +93,11 @@ export abstract class AbstractWorkerChoiceStrategy< } } + protected resetWorkerNodeKeyProperties (): void { + this.nextWorkerNodeKey = 0 + this.previousWorkerNodeKey = 0 + } + /** @inheritDoc */ public abstract reset (): boolean @@ -190,27 +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 worker node key. */ - protected assignChosenWorkerNodeKey ( - chosenWorkerNodeKey: number | undefined - ): void { - if (chosenWorkerNodeKey != null) { - this.nextWorkerNodeKey = chosenWorkerNodeKey - } else { - this.nextWorkerNodeKey = undefined - } - } - protected checkNextWorkerNodeEligibility ( - chosenWorkerNodeKey: number | undefined + chosenNextWorkerNodeKey: number | undefined ): void { if (!this.isWorkerNodeEligible(this.nextWorkerNodeKey as number)) { this.nextWorkerNodeKey = undefined this.previousWorkerNodeKey = - chosenWorkerNodeKey ?? this.previousWorkerNodeKey + chosenNextWorkerNodeKey ?? this.previousWorkerNodeKey } }