X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fselection-strategies%2Fround-robin-worker-choice-strategy.ts;h=83126d97847887d9a079cc6f875077b1494729c9;hb=bcf1c155ec2e2d9208c8f818abd031662bd61d7f;hp=7c49cec75689a8ca64aa101b51ec8f86890f1409;hpb=a38b62f12dcf25476b2d0409edfa98f96a36da20;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 7c49cec7..83126d97 100644 --- a/src/pools/selection-strategies/round-robin-worker-choice-strategy.ts +++ b/src/pools/selection-strategies/round-robin-worker-choice-strategy.ts @@ -1,11 +1,10 @@ -import { DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS } from '../../utils' -import type { IPool } from '../pool' -import type { IWorker } from '../worker' -import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy' +import type { IPool } from '../pool.js' +import type { IWorker } from '../worker.js' +import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy.js' import type { IWorkerChoiceStrategy, WorkerChoiceStrategyOptions -} from './selection-strategies-types' +} from './selection-strategies-types.js' /** * Selects the next worker in a round robin fashion. @@ -24,10 +23,9 @@ export class RoundRobinWorkerChoiceStrategy< /** @inheritDoc */ public constructor ( pool: IPool, - opts: WorkerChoiceStrategyOptions = DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS + opts?: WorkerChoiceStrategyOptions ) { super(pool, opts) - this.setTaskStatisticsRequirements(this.opts) } /** @inheritDoc */ @@ -46,7 +44,7 @@ export class RoundRobinWorkerChoiceStrategy< const chosenWorkerNodeKey = this.nextWorkerNodeKey this.setPreviousWorkerNodeKey(chosenWorkerNodeKey) this.roundRobinNextWorkerNodeKey() - this.checkNextWorkerNodeReadiness() + this.checkNextWorkerNodeKey() return chosenWorkerNodeKey } @@ -54,6 +52,7 @@ export class RoundRobinWorkerChoiceStrategy< public remove (workerNodeKey: number): boolean { if (this.pool.workerNodes.length === 0) { this.reset() + return true } if ( this.nextWorkerNodeKey === workerNodeKey &&