From: Jérôme Benoit Date: Thu, 8 Jun 2023 18:03:38 +0000 (+0200) Subject: fix: fix build after merge with main X-Git-Tag: v2.6.0~7^2~17 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=cdb517b318cd4f26b4895988ae8444d50945ddde;p=poolifier.git fix: fix build after merge with main Signed-off-by: Jérôme Benoit --- diff --git a/src/pools/selection-strategies/least-elu-worker-choice-strategy.ts b/src/pools/selection-strategies/least-elu-worker-choice-strategy.ts index f58e3b50..41ebf7fb 100644 --- a/src/pools/selection-strategies/least-elu-worker-choice-strategy.ts +++ b/src/pools/selection-strategies/least-elu-worker-choice-strategy.ts @@ -54,15 +54,15 @@ export class LeastEluWorkerChoiceStrategy< /** @inheritDoc */ public choose (): number { - let minTasksElu = Infinity + let minWorkerElu = Infinity let leastEluWorkerNodeKey!: number for (const [workerNodeKey, workerNode] of this.pool.workerNodes.entries()) { - const tasksUsage = workerNode.tasksUsage - const tasksElu = tasksUsage.elu?.utilization ?? 0 - if (tasksElu === 0) { + const workerUsage = workerNode.workerUsage + const workerElu = workerUsage.elu?.utilization ?? 0 + if (workerElu === 0) { return workerNodeKey - } else if (tasksElu < minTasksElu) { - minTasksElu = tasksElu + } else if (workerElu < minWorkerElu) { + minWorkerElu = workerElu leastEluWorkerNodeKey = workerNodeKey } } diff --git a/tests/pools/selection-strategies/selection-strategies.test.js b/tests/pools/selection-strategies/selection-strategies.test.js index 62e2e522..24a35810 100644 --- a/tests/pools/selection-strategies/selection-strategies.test.js +++ b/tests/pools/selection-strategies/selection-strategies.test.js @@ -14,6 +14,7 @@ describe('Selection strategies test suite', () => { it('Verify that WorkerChoiceStrategies enumeration provides string values', () => { expect(WorkerChoiceStrategies.ROUND_ROBIN).toBe('ROUND_ROBIN') expect(WorkerChoiceStrategies.LEAST_USED).toBe('LEAST_USED') + expect(WorkerChoiceStrategies.LEAST_ELU).toBe('LEAST_ELU') expect(WorkerChoiceStrategies.LEAST_BUSY).toBe('LEAST_BUSY') expect(WorkerChoiceStrategies.FAIR_SHARE).toBe('FAIR_SHARE') expect(WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN).toBe(