X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fselection-strategies%2Fabstract-worker-choice-strategy.ts;h=3c41dd6ffee305c8eb2f51f593df022d8889745b;hb=64f97d12e2027203715ee0129d036e1d2b42e2a2;hp=2fba4e9fbd1a17be10fd9d6a86a6cb574a9ad03b;hpb=e907c7098316b8b10928c2a716626c710457ae27;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 2fba4e9f..3c41dd6f 100644 --- a/src/pools/selection-strategies/abstract-worker-choice-strategy.ts +++ b/src/pools/selection-strategies/abstract-worker-choice-strategy.ts @@ -195,17 +195,20 @@ export abstract class AbstractWorkerChoiceStrategy< } /** - * Check the next worker node eligibility. + * Sets safely the previous worker node key. * - * @param chosenNextWorkerNodeKey - The chosen worker node key. + * @param workerNodeKey - The worker node key. */ - protected checkNextWorkerNodeEligibility ( - chosenNextWorkerNodeKey: number | undefined - ): void { + protected setPreviousWorkerNodeKey (workerNodeKey: number | undefined): void { + this.previousWorkerNodeKey = workerNodeKey ?? this.previousWorkerNodeKey + } + + /** + * Check the next worker node eligibility. + */ + protected checkNextWorkerNodeEligibility (): void { if (!this.isWorkerNodeEligible(this.nextWorkerNodeKey as number)) { this.nextWorkerNodeKey = undefined - this.previousWorkerNodeKey = - chosenNextWorkerNodeKey ?? this.previousWorkerNodeKey } }