X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fselection-strategies%2Fleast-busy-worker-choice-strategy.ts;h=0370212fc5ea0a2b4e7777ad8bf10de7fa5a0ae6;hb=213e817d69db5ac80137ef59ed5cdadcde4d73cf;hp=6e413825d666025022acf6018dfe47c77e8345fe;hpb=2cf93bc8e7b3d9c6c642288939732edd7cd9142d;p=poolifier.git diff --git a/src/pools/selection-strategies/least-busy-worker-choice-strategy.ts b/src/pools/selection-strategies/least-busy-worker-choice-strategy.ts index 6e413825..0370212f 100644 --- a/src/pools/selection-strategies/least-busy-worker-choice-strategy.ts +++ b/src/pools/selection-strategies/least-busy-worker-choice-strategy.ts @@ -4,7 +4,7 @@ import type { IWorker } from '../worker' import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy' import type { IWorkerChoiceStrategy, - RequiredStatistics, + TaskStatistics, WorkerChoiceStrategyOptions } from './selection-strategies-types' @@ -23,13 +23,14 @@ export class LeastBusyWorkerChoiceStrategy< extends AbstractWorkerChoiceStrategy implements IWorkerChoiceStrategy { /** @inheritDoc */ - public readonly requiredStatistics: RequiredStatistics = { + public readonly taskStatistics: TaskStatistics = { runTime: true, avgRunTime: false, medRunTime: false, waitTime: false, avgWaitTime: false, - medWaitTime: false + medWaitTime: false, + elu: false } /** @inheritDoc */ @@ -38,7 +39,7 @@ export class LeastBusyWorkerChoiceStrategy< opts: WorkerChoiceStrategyOptions = DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS ) { super(pool, opts) - this.setRequiredStatistics(this.opts) + this.setTaskStatistics(this.opts) } /** @inheritDoc */ @@ -53,10 +54,6 @@ export class LeastBusyWorkerChoiceStrategy< /** @inheritDoc */ public choose (): number { - const freeWorkerNodeKey = this.findFreeWorkerNodeKey() - if (freeWorkerNodeKey !== -1) { - return freeWorkerNodeKey - } let minRunTime = Infinity let leastBusyWorkerNodeKey!: number for (const [workerNodeKey, workerNode] of this.pool.workerNodes.entries()) {