X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fselection-strategies%2Fleast-busy-worker-choice-strategy.ts;h=67332c70c4b21a895e97a3fa037526b5da57bc33;hb=6368f44b560e5a13e2e0323ccfa7d9291ef140dd;hp=6e413825d666025022acf6018dfe47c77e8345fe;hpb=ec3e56520d46660ea043d5184f5d8246c834d252;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..67332c70 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,10 @@ export class LeastBusyWorkerChoiceStrategy< /** @inheritDoc */ public choose (): number { - const freeWorkerNodeKey = this.findFreeWorkerNodeKey() - if (freeWorkerNodeKey !== -1) { - return freeWorkerNodeKey - } + // const freeWorkerNodeKey = this.findFreeWorkerNodeKey() + // if (freeWorkerNodeKey !== -1) { + // return freeWorkerNodeKey + // } let minRunTime = Infinity let leastBusyWorkerNodeKey!: number for (const [workerNodeKey, workerNode] of this.pool.workerNodes.entries()) {