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=d017122113cce8c5ef62a8f0812522fba1a354ad;hpb=39a43af7ad68492916bd118e29fde53cec533cfa;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 d0171221..3c41dd6f 100644 --- a/src/pools/selection-strategies/abstract-worker-choice-strategy.ts +++ b/src/pools/selection-strategies/abstract-worker-choice-strategy.ts @@ -195,27 +195,20 @@ export abstract class AbstractWorkerChoiceStrategy< } /** - * Assign to nextWorkerNodeKey property the chosen worker node key. + * Sets safely the previous worker node key. * - * @param chosenWorkerNodeKey - The chosen worker node key. + * @param workerNodeKey - The worker node key. */ - protected assignChosenWorkerNodeKey ( - chosenWorkerNodeKey: number | undefined - ): void { - if (chosenWorkerNodeKey != null) { - this.nextWorkerNodeKey = chosenWorkerNodeKey - } else { - this.nextWorkerNodeKey = undefined - } + protected setPreviousWorkerNodeKey (workerNodeKey: number | undefined): void { + this.previousWorkerNodeKey = workerNodeKey ?? this.previousWorkerNodeKey } - protected checkNextWorkerNodeEligibility ( - chosenWorkerNodeKey: number | undefined - ): void { + /** + * Check the next worker node eligibility. + */ + protected checkNextWorkerNodeEligibility (): void { if (!this.isWorkerNodeEligible(this.nextWorkerNodeKey as number)) { this.nextWorkerNodeKey = undefined - this.previousWorkerNodeKey = - chosenWorkerNodeKey ?? this.previousWorkerNodeKey } }