X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fselection-strategies%2Fabstract-worker-choice-strategy.ts;h=d017122113cce8c5ef62a8f0812522fba1a354ad;hb=e695d66fae7e1343a140fee2eaecb5069432fc36;hp=fb3bf707386f8bdb2bb9aac23ccf6db9d851ac96;hpb=f6bc9f26d8a0246bbee14b2b03d0bcc41b8aeb52;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 fb3bf707..d0171221 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 @@ -204,6 +209,16 @@ export abstract class AbstractWorkerChoiceStrategy< } } + protected checkNextWorkerNodeEligibility ( + chosenWorkerNodeKey: number | undefined + ): void { + if (!this.isWorkerNodeEligible(this.nextWorkerNodeKey as number)) { + this.nextWorkerNodeKey = undefined + this.previousWorkerNodeKey = + chosenWorkerNodeKey ?? this.previousWorkerNodeKey + } + } + protected computeDefaultWorkerWeight (): number { let cpusCycleTimeWeight = 0 for (const cpu of cpus()) {