X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fselection-strategies%2Fabstract-worker-choice-strategy.ts;h=3c41dd6ffee305c8eb2f51f593df022d8889745b;hb=86ed05989a886c9e44d5be0089d5381debfb2294;hp=cd8736c25e771470871497be2ef2f6933105aaa4;hpb=619f403be01e2954cef4c490f76240b192f16276;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 cd8736c2..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 next 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 } }