X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fselection-strategies%2Fround-robin-worker-choice-strategy.ts;h=8a5656b80701fdf0f943b8e651ce0b00a5349f9f;hb=aa1e0433fcfdc47175d6144524bcda57ab2947a1;hp=10bdf8714b8bbd23eaf1fab96051ed11e7094bdd;hpb=b1aae69557f4f5c524f665e92882b76f23a19866;p=poolifier.git diff --git a/src/pools/selection-strategies/round-robin-worker-choice-strategy.ts b/src/pools/selection-strategies/round-robin-worker-choice-strategy.ts index 10bdf871..8a5656b8 100644 --- a/src/pools/selection-strategies/round-robin-worker-choice-strategy.ts +++ b/src/pools/selection-strategies/round-robin-worker-choice-strategy.ts @@ -4,7 +4,6 @@ import type { IWorker } from '../worker' import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy' import type { IWorkerChoiceStrategy, - StrategyPolicy, WorkerChoiceStrategyOptions } from './selection-strategies-types' @@ -22,12 +21,6 @@ export class RoundRobinWorkerChoiceStrategy< > extends AbstractWorkerChoiceStrategy implements IWorkerChoiceStrategy { - /** @inheritDoc */ - public readonly strategyPolicy: StrategyPolicy = { - dynamicWorkerUsage: true, - dynamicWorkerReady: true - } - /** @inheritDoc */ public constructor ( pool: IPool, @@ -39,7 +32,7 @@ export class RoundRobinWorkerChoiceStrategy< /** @inheritDoc */ public reset (): boolean { - this.nextWorkerNodeKey = 0 + this.resetWorkerNodeKeyProperties() return true } @@ -52,9 +45,6 @@ export class RoundRobinWorkerChoiceStrategy< public choose (): number | undefined { const chosenWorkerNodeKey = this.nextWorkerNodeKey this.roundRobinNextWorkerNodeKey() - if (!this.isWorkerNodeEligible(this.nextWorkerNodeKey as number)) { - this.nextWorkerNodeKey = undefined - } return chosenWorkerNodeKey } @@ -74,7 +64,7 @@ export class RoundRobinWorkerChoiceStrategy< this.nextWorkerNodeKey = this.nextWorkerNodeKey === this.pool.workerNodes.length - 1 ? 0 - : (this.nextWorkerNodeKey ?? 0) + 1 + : (this.nextWorkerNodeKey ?? this.previousWorkerNodeKey) + 1 return this.nextWorkerNodeKey } }