X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fselection-strategies%2Fleast-used-worker-choice-strategy.ts;h=4161a1d266634518c5800d57a421acb46b690fe6;hb=5df69fabd77b3ec4137a6382e2d84791bf0fe85d;hp=d9e3c20e1d56e951238cdbfc47ab2c4698ca999a;hpb=b6b3245344bd453ea91fa3d74acd5145f70d84fd;p=poolifier.git diff --git a/src/pools/selection-strategies/least-used-worker-choice-strategy.ts b/src/pools/selection-strategies/least-used-worker-choice-strategy.ts index d9e3c20e..4161a1d2 100644 --- a/src/pools/selection-strategies/least-used-worker-choice-strategy.ts +++ b/src/pools/selection-strategies/least-used-worker-choice-strategy.ts @@ -27,7 +27,7 @@ export class LeastUsedWorkerChoiceStrategy< opts: WorkerChoiceStrategyOptions = DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS ) { super(pool, opts) - this.setTaskStatistics(this.opts) + this.setTaskStatisticsRequirements(this.opts) } /** @inheritDoc */ @@ -49,8 +49,11 @@ export class LeastUsedWorkerChoiceStrategy< let minNumberOfTasks = Infinity let leastUsedWorkerNodeKey!: number for (const [workerNodeKey, workerNode] of this.pool.workerNodes.entries()) { - const tasksUsage = workerNode.tasksUsage - const workerTasks = tasksUsage.ran + tasksUsage.running + const workerTaskStatistics = workerNode.workerUsage.tasks + const workerTasks = + workerTaskStatistics.executed + + workerTaskStatistics.executing + + workerTaskStatistics.queued if (workerTasks === 0) { return workerNodeKey } else if (workerTasks < minNumberOfTasks) {