From e4543b1428fd6b52f5832ea75f21ac082b52684e Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Tue, 30 May 2023 10:40:59 +0200 Subject: [PATCH] refactor: rename worker choice strategies to sensible names MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- CHANGELOG.md | 8 +++ README.md | 4 +- benchmarks/internal/bench.js | 72 +++++++++---------- benchmarks/worker-selection/less.js | 2 +- ...s => least-busy-worker-choice-strategy.ts} | 10 +-- ...s => least-used-worker-choice-strategy.ts} | 10 +-- .../selection-strategies-types.ts | 8 +-- .../worker-choice-strategy-context.ts | 12 ++-- tests/pools/abstract/abstract-pool.test.js | 4 +- .../selection-strategies.test.js | 36 +++++----- .../worker-choice-strategy-context.test.js | 32 ++++----- 11 files changed, 103 insertions(+), 95 deletions(-) rename src/pools/selection-strategies/{less-busy-worker-choice-strategy.ts => least-busy-worker-choice-strategy.ts} (90%) rename src/pools/selection-strategies/{less-used-worker-choice-strategy.ts => least-used-worker-choice-strategy.ts} (90%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 200e61dd..920c0b4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- Switch pool event emitter to `EventEmitterAsyncResource`. + +### Changed + +- Renamed worker choice strategy `LESS_BUSY` to `LEAST_BUSY` and `LESS_USED` to `LEAST_USED`. + ## [2.4.14] - 2023-05-09 ### Fixed diff --git a/README.md b/README.md index 3eeebed1..52650f3e 100644 --- a/README.md +++ b/README.md @@ -162,8 +162,8 @@ Node versions >= 16.14.x are supported. - `workerChoiceStrategy` (optional) - The worker choice strategy to use in this pool: - `WorkerChoiceStrategies.ROUND_ROBIN`: Submit tasks to worker in a round robbin fashion - - `WorkerChoiceStrategies.LESS_USED`: Submit tasks to the less used worker - - `WorkerChoiceStrategies.LESS_BUSY`: Submit tasks to the less busy worker + - `WorkerChoiceStrategies.LEAST_USED`: Submit tasks to the least used worker + - `WorkerChoiceStrategies.LEAST_BUSY`: Submit tasks to the least busy worker - `WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN`: Submit tasks to worker using a weighted round robin scheduling algorithm based on tasks execution time - `WorkerChoiceStrategies.FAIR_SHARE`: Submit tasks to worker using a fair share tasks scheduling algorithm based on tasks execution time diff --git a/benchmarks/internal/bench.js b/benchmarks/internal/bench.js index 4663d9c4..94b49f13 100644 --- a/benchmarks/internal/bench.js +++ b/benchmarks/internal/bench.js @@ -17,11 +17,11 @@ const tasksQueuePoolOption = { enableTasksQueue: true } const workerChoiceStrategyRoundRobinPoolOption = { workerChoiceStrategy: WorkerChoiceStrategies.ROUND_ROBIN } -const workerChoiceStrategyLessUsedPoolOption = { - workerChoiceStrategy: WorkerChoiceStrategies.LESS_USED +const workerChoiceStrategyLeastUsedPoolOption = { + workerChoiceStrategy: WorkerChoiceStrategies.LEAST_USED } -const workerChoiceStrategyLessBusyPoolOption = { - workerChoiceStrategy: WorkerChoiceStrategies.LESS_BUSY +const workerChoiceStrategyLeastBusyPoolOption = { + workerChoiceStrategy: WorkerChoiceStrategies.LEAST_BUSY } const workerChoiceStrategyWeightedRoundRobinPoolOption = { workerChoiceStrategy: WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN @@ -44,18 +44,18 @@ const fixedThreadPoolRoundRobinTasksQueue = buildPool( { ...workerChoiceStrategyRoundRobinPoolOption, ...tasksQueuePoolOption } ) -const fixedThreadPoolLessUsed = buildPool( +const fixedThreadPoolLeastUsed = buildPool( WorkerTypes.THREAD, PoolTypes.FIXED, poolSize, - workerChoiceStrategyLessUsedPoolOption + workerChoiceStrategyLeastUsedPoolOption ) -const fixedThreadPoolLessBusy = buildPool( +const fixedThreadPoolLeastBusy = buildPool( WorkerTypes.THREAD, PoolTypes.FIXED, poolSize, - workerChoiceStrategyLessBusyPoolOption + workerChoiceStrategyLeastBusyPoolOption ) const fixedThreadPoolWeightedRoundRobin = buildPool( @@ -86,18 +86,18 @@ const dynamicThreadPoolRoundRobin = buildPool( workerChoiceStrategyRoundRobinPoolOption ) -const dynamicThreadPoolLessUsed = buildPool( +const dynamicThreadPoolLeastUsed = buildPool( WorkerTypes.THREAD, PoolTypes.DYNAMIC, poolSize, - workerChoiceStrategyLessUsedPoolOption + workerChoiceStrategyLeastUsedPoolOption ) -const dynamicThreadPoolLessBusy = buildPool( +const dynamicThreadPoolLeastBusy = buildPool( WorkerTypes.THREAD, PoolTypes.DYNAMIC, poolSize, - workerChoiceStrategyLessBusyPoolOption + workerChoiceStrategyLeastBusyPoolOption ) const dynamicThreadPoolWeightedRoundRobin = buildPool( @@ -128,18 +128,18 @@ const fixedClusterPoolRoundRobinTasksQueue = buildPool( { ...workerChoiceStrategyRoundRobinPoolOption, ...tasksQueuePoolOption } ) -const fixedClusterPoolLessUsed = buildPool( +const fixedClusterPoolLeastUsed = buildPool( WorkerTypes.CLUSTER, PoolTypes.FIXED, poolSize, - workerChoiceStrategyLessUsedPoolOption + workerChoiceStrategyLeastUsedPoolOption ) -const fixedClusterPoolLessBusy = buildPool( +const fixedClusterPoolLeastBusy = buildPool( WorkerTypes.CLUSTER, PoolTypes.FIXED, poolSize, - workerChoiceStrategyLessBusyPoolOption + workerChoiceStrategyLeastBusyPoolOption ) const fixedClusterPoolWeightedRoundRobin = buildPool( @@ -170,18 +170,18 @@ const dynamicClusterPoolRoundRobin = buildPool( workerChoiceStrategyRoundRobinPoolOption ) -const dynamicClusterPoolLessUsed = buildPool( +const dynamicClusterPoolLeastUsed = buildPool( WorkerTypes.CLUSTER, PoolTypes.DYNAMIC, poolSize, - workerChoiceStrategyLessUsedPoolOption + workerChoiceStrategyLeastUsedPoolOption ) -const dynamicClusterPoolLessBusy = buildPool( +const dynamicClusterPoolLeastBusy = buildPool( WorkerTypes.CLUSTER, PoolTypes.DYNAMIC, poolSize, - workerChoiceStrategyLessBusyPoolOption + workerChoiceStrategyLeastBusyPoolOption ) const dynamicClusterPoolWeightedRoundRobin = buildPool( @@ -218,14 +218,14 @@ Benchmark.suite( }) } ), - Benchmark.add('Fixed:ThreadPool:LessUsed', async () => { - await runTest(fixedThreadPoolLessUsed, { + Benchmark.add('Fixed:ThreadPool:LeastUsed', async () => { + await runTest(fixedThreadPoolLeastUsed, { taskExecutions, workerData }) }), - Benchmark.add('Fixed:ThreadPool:LessBusy', async () => { - await runTest(fixedThreadPoolLessBusy, { + Benchmark.add('Fixed:ThreadPool:LeastBusy', async () => { + await runTest(fixedThreadPoolLeastBusy, { taskExecutions, workerData }) @@ -257,14 +257,14 @@ Benchmark.suite( workerData }) }), - Benchmark.add('Dynamic:ThreadPool:LessUsed', async () => { - await runTest(dynamicThreadPoolLessUsed, { + Benchmark.add('Dynamic:ThreadPool:LeastUsed', async () => { + await runTest(dynamicThreadPoolLeastUsed, { taskExecutions, workerData }) }), - Benchmark.add('Dynamic:ThreadPool:LessBusy', async () => { - await runTest(dynamicThreadPoolLessBusy, { + Benchmark.add('Dynamic:ThreadPool:LeastBusy', async () => { + await runTest(dynamicThreadPoolLeastBusy, { taskExecutions, workerData }) @@ -296,14 +296,14 @@ Benchmark.suite( }) } ), - Benchmark.add('Fixed:ClusterPool:LessUsed', async () => { - await runTest(fixedClusterPoolLessUsed, { + Benchmark.add('Fixed:ClusterPool:LeastUsed', async () => { + await runTest(fixedClusterPoolLeastUsed, { taskExecutions, workerData }) }), - Benchmark.add('Fixed:ClusterPool:LessBusy', async () => { - await runTest(fixedClusterPoolLessBusy, { + Benchmark.add('Fixed:ClusterPool:LeastBusy', async () => { + await runTest(fixedClusterPoolLeastBusy, { taskExecutions, workerData }) @@ -335,14 +335,14 @@ Benchmark.suite( workerData }) }), - Benchmark.add('Dynamic:ClusterPool:LessUsed', async () => { - await runTest(dynamicClusterPoolLessUsed, { + Benchmark.add('Dynamic:ClusterPool:LeastUsed', async () => { + await runTest(dynamicClusterPoolLeastUsed, { taskExecutions, workerData }) }), - Benchmark.add('Dynamic:ClusterPool:LessBusy', async () => { - await runTest(dynamicClusterPoolLessBusy, { + Benchmark.add('Dynamic:ClusterPool:LeastBusy', async () => { + await runTest(dynamicClusterPoolLeastBusy, { taskExecutions, workerData }) diff --git a/benchmarks/worker-selection/less.js b/benchmarks/worker-selection/less.js index 80d78893..3733cf6d 100644 --- a/benchmarks/worker-selection/less.js +++ b/benchmarks/worker-selection/less.js @@ -168,7 +168,7 @@ function quickSelectRecursionRandomPivot (tasksMap) { } Benchmark.suite( - 'Less used worker tasks distribution', + 'Least used worker tasks distribution', Benchmark.add('Loop select', () => { loopSelect(tasksMap) }), diff --git a/src/pools/selection-strategies/less-busy-worker-choice-strategy.ts b/src/pools/selection-strategies/least-busy-worker-choice-strategy.ts similarity index 90% rename from src/pools/selection-strategies/less-busy-worker-choice-strategy.ts rename to src/pools/selection-strategies/least-busy-worker-choice-strategy.ts index f518f9b1..05caa42a 100644 --- a/src/pools/selection-strategies/less-busy-worker-choice-strategy.ts +++ b/src/pools/selection-strategies/least-busy-worker-choice-strategy.ts @@ -9,13 +9,13 @@ import type { } from './selection-strategies-types' /** - * Selects the less busy worker. + * Selects the least busy worker. * * @typeParam Worker - Type of worker which manages the strategy. * @typeParam Data - Type of data sent to the worker. This can only be serializable data. * @typeParam Response - Type of execution response. This can only be serializable data. */ -export class LessBusyWorkerChoiceStrategy< +export class LeastBusyWorkerChoiceStrategy< Worker extends IWorker, Data = unknown, Response = unknown @@ -55,17 +55,17 @@ export class LessBusyWorkerChoiceStrategy< return freeWorkerNodeKey } let minRunTime = Infinity - let lessBusyWorkerNodeKey!: number + let leastBusyWorkerNodeKey!: number for (const [workerNodeKey, workerNode] of this.pool.workerNodes.entries()) { const workerRunTime = workerNode.tasksUsage.runTime if (workerRunTime === 0) { return workerNodeKey } else if (workerRunTime < minRunTime) { minRunTime = workerRunTime - lessBusyWorkerNodeKey = workerNodeKey + leastBusyWorkerNodeKey = workerNodeKey } } - return lessBusyWorkerNodeKey + return leastBusyWorkerNodeKey } /** @inheritDoc */ diff --git a/src/pools/selection-strategies/less-used-worker-choice-strategy.ts b/src/pools/selection-strategies/least-used-worker-choice-strategy.ts similarity index 90% rename from src/pools/selection-strategies/less-used-worker-choice-strategy.ts rename to src/pools/selection-strategies/least-used-worker-choice-strategy.ts index a8daa7b9..85e145a0 100644 --- a/src/pools/selection-strategies/less-used-worker-choice-strategy.ts +++ b/src/pools/selection-strategies/least-used-worker-choice-strategy.ts @@ -8,13 +8,13 @@ import type { } from './selection-strategies-types' /** - * Selects the less used worker. + * Selects the least used worker. * * @typeParam Worker - Type of worker which manages the strategy. * @typeParam Data - Type of data sent to the worker. This can only be serializable data. * @typeParam Response - Type of execution response. This can only be serializable data. */ -export class LessUsedWorkerChoiceStrategy< +export class LeastUsedWorkerChoiceStrategy< Worker extends IWorker, Data = unknown, Response = unknown @@ -47,7 +47,7 @@ export class LessUsedWorkerChoiceStrategy< return freeWorkerNodeKey } let minNumberOfTasks = Infinity - let lessUsedWorkerNodeKey!: number + let leastUsedWorkerNodeKey!: number for (const [workerNodeKey, workerNode] of this.pool.workerNodes.entries()) { const tasksUsage = workerNode.tasksUsage const workerTasks = tasksUsage.run + tasksUsage.running @@ -55,10 +55,10 @@ export class LessUsedWorkerChoiceStrategy< return workerNodeKey } else if (workerTasks < minNumberOfTasks) { minNumberOfTasks = workerTasks - lessUsedWorkerNodeKey = workerNodeKey + leastUsedWorkerNodeKey = workerNodeKey } } - return lessUsedWorkerNodeKey + return leastUsedWorkerNodeKey } /** @inheritDoc */ diff --git a/src/pools/selection-strategies/selection-strategies-types.ts b/src/pools/selection-strategies/selection-strategies-types.ts index ddfe915d..282e306d 100644 --- a/src/pools/selection-strategies/selection-strategies-types.ts +++ b/src/pools/selection-strategies/selection-strategies-types.ts @@ -7,13 +7,13 @@ export const WorkerChoiceStrategies = Object.freeze({ */ ROUND_ROBIN: 'ROUND_ROBIN', /** - * Less used worker selection strategy. + * Least used worker selection strategy. */ - LESS_USED: 'LESS_USED', + LEAST_USED: 'LEAST_USED', /** - * Less busy worker selection strategy. + * Least busy worker selection strategy. */ - LESS_BUSY: 'LESS_BUSY', + LEAST_BUSY: 'LEAST_BUSY', /** * Fair share worker selection strategy. */ diff --git a/src/pools/selection-strategies/worker-choice-strategy-context.ts b/src/pools/selection-strategies/worker-choice-strategy-context.ts index e07808bc..21c24f7c 100644 --- a/src/pools/selection-strategies/worker-choice-strategy-context.ts +++ b/src/pools/selection-strategies/worker-choice-strategy-context.ts @@ -2,8 +2,8 @@ import { DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS } from '../../utils' import type { IPool } from '../pool' import type { IWorker } from '../worker' import { FairShareWorkerChoiceStrategy } from './fair-share-worker-choice-strategy' -import { LessBusyWorkerChoiceStrategy } from './less-busy-worker-choice-strategy' -import { LessUsedWorkerChoiceStrategy } from './less-used-worker-choice-strategy' +import { LeastBusyWorkerChoiceStrategy } from './least-busy-worker-choice-strategy' +import { LeastUsedWorkerChoiceStrategy } from './least-used-worker-choice-strategy' import { RoundRobinWorkerChoiceStrategy } from './round-robin-worker-choice-strategy' import type { IWorkerChoiceStrategy, @@ -56,15 +56,15 @@ export class WorkerChoiceStrategyContext< ) ], [ - WorkerChoiceStrategies.LESS_USED, - new (LessUsedWorkerChoiceStrategy.bind(this))( + WorkerChoiceStrategies.LEAST_USED, + new (LeastUsedWorkerChoiceStrategy.bind(this))( pool, opts ) ], [ - WorkerChoiceStrategies.LESS_BUSY, - new (LessBusyWorkerChoiceStrategy.bind(this))( + WorkerChoiceStrategies.LEAST_BUSY, + new (LeastBusyWorkerChoiceStrategy.bind(this))( pool, opts ) diff --git a/tests/pools/abstract/abstract-pool.test.js b/tests/pools/abstract/abstract-pool.test.js index bf01176d..02baefaf 100644 --- a/tests/pools/abstract/abstract-pool.test.js +++ b/tests/pools/abstract/abstract-pool.test.js @@ -102,7 +102,7 @@ describe('Abstract pool test suite', () => { numberOfWorkers, './tests/worker-files/thread/testWorker.js', { - workerChoiceStrategy: WorkerChoiceStrategies.LESS_USED, + workerChoiceStrategy: WorkerChoiceStrategies.LEAST_USED, workerChoiceStrategyOptions: { medRunTime: true, weights: { 0: 300 } @@ -121,7 +121,7 @@ describe('Abstract pool test suite', () => { expect(pool.opts.enableTasksQueue).toBe(true) expect(pool.opts.tasksQueueOptions).toStrictEqual({ concurrency: 2 }) expect(pool.opts.workerChoiceStrategy).toBe( - WorkerChoiceStrategies.LESS_USED + WorkerChoiceStrategies.LEAST_USED ) expect(pool.opts.workerChoiceStrategyOptions).toStrictEqual({ medRunTime: true, diff --git a/tests/pools/selection-strategies/selection-strategies.test.js b/tests/pools/selection-strategies/selection-strategies.test.js index 33d2114c..9e3e99e3 100644 --- a/tests/pools/selection-strategies/selection-strategies.test.js +++ b/tests/pools/selection-strategies/selection-strategies.test.js @@ -12,8 +12,8 @@ describe('Selection strategies test suite', () => { it('Verify that WorkerChoiceStrategies enumeration provides string values', () => { expect(WorkerChoiceStrategies.ROUND_ROBIN).toBe('ROUND_ROBIN') - expect(WorkerChoiceStrategies.LESS_USED).toBe('LESS_USED') - expect(WorkerChoiceStrategies.LESS_BUSY).toBe('LESS_BUSY') + expect(WorkerChoiceStrategies.LEAST_USED).toBe('LEAST_USED') + expect(WorkerChoiceStrategies.LEAST_BUSY).toBe('LEAST_BUSY') expect(WorkerChoiceStrategies.FAIR_SHARE).toBe('FAIR_SHARE') expect(WorkerChoiceStrategies.WEIGHTED_ROUND_ROBIN).toBe( 'WEIGHTED_ROUND_ROBIN' @@ -243,8 +243,8 @@ describe('Selection strategies test suite', () => { await pool.destroy() }) - it('Verify LESS_USED strategy default tasks usage statistics requirements', async () => { - const workerChoiceStrategy = WorkerChoiceStrategies.LESS_USED + it('Verify LEAST_USED strategy default tasks usage statistics requirements', async () => { + const workerChoiceStrategy = WorkerChoiceStrategies.LEAST_USED let pool = new FixedThreadPool( max, './tests/worker-files/thread/testWorker.js', @@ -279,13 +279,13 @@ describe('Selection strategies test suite', () => { await pool.destroy() }) - it('Verify LESS_USED strategy can be run in a fixed pool', async () => { + it('Verify LEAST_USED strategy can be run in a fixed pool', async () => { const pool = new FixedThreadPool( max, './tests/worker-files/thread/testWorker.js', - { workerChoiceStrategy: WorkerChoiceStrategies.LESS_USED } + { workerChoiceStrategy: WorkerChoiceStrategies.LEAST_USED } ) - // TODO: Create a better test to cover `LessUsedWorkerChoiceStrategy#choose` + // TODO: Create a better test to cover `LeastUsedWorkerChoiceStrategy#choose` const maxMultiplier = 2 for (let i = 0; i < max * maxMultiplier; i++) { await pool.execute() @@ -294,14 +294,14 @@ describe('Selection strategies test suite', () => { await pool.destroy() }) - it('Verify LESS_USED strategy can be run in a dynamic pool', async () => { + it('Verify LEAST_USED strategy can be run in a dynamic pool', async () => { const pool = new DynamicThreadPool( min, max, './tests/worker-files/thread/testWorker.js', - { workerChoiceStrategy: WorkerChoiceStrategies.LESS_USED } + { workerChoiceStrategy: WorkerChoiceStrategies.LEAST_USED } ) - // TODO: Create a better test to cover `LessUsedWorkerChoiceStrategy#choose` + // TODO: Create a better test to cover `LeastUsedWorkerChoiceStrategy#choose` const maxMultiplier = 2 for (let i = 0; i < max * maxMultiplier; i++) { await pool.execute() @@ -310,8 +310,8 @@ describe('Selection strategies test suite', () => { await pool.destroy() }) - it('Verify LESS_BUSY strategy default tasks usage statistics requirements', async () => { - const workerChoiceStrategy = WorkerChoiceStrategies.LESS_BUSY + it('Verify LEAST_BUSY strategy default tasks usage statistics requirements', async () => { + const workerChoiceStrategy = WorkerChoiceStrategies.LEAST_BUSY let pool = new FixedThreadPool( max, './tests/worker-files/thread/testWorker.js', @@ -346,13 +346,13 @@ describe('Selection strategies test suite', () => { await pool.destroy() }) - it('Verify LESS_BUSY strategy can be run in a fixed pool', async () => { + it('Verify LEAST_BUSY strategy can be run in a fixed pool', async () => { const pool = new FixedThreadPool( max, './tests/worker-files/thread/testWorker.js', - { workerChoiceStrategy: WorkerChoiceStrategies.LESS_BUSY } + { workerChoiceStrategy: WorkerChoiceStrategies.LEAST_BUSY } ) - // TODO: Create a better test to cover `LessBusyWorkerChoiceStrategy#choose` + // TODO: Create a better test to cover `LeastBusyWorkerChoiceStrategy#choose` const maxMultiplier = 2 for (let i = 0; i < max * maxMultiplier; i++) { await pool.execute() @@ -361,14 +361,14 @@ describe('Selection strategies test suite', () => { await pool.destroy() }) - it('Verify LESS_BUSY strategy can be run in a dynamic pool', async () => { + it('Verify LEAST_BUSY strategy can be run in a dynamic pool', async () => { const pool = new DynamicThreadPool( min, max, './tests/worker-files/thread/testWorker.js', - { workerChoiceStrategy: WorkerChoiceStrategies.LESS_BUSY } + { workerChoiceStrategy: WorkerChoiceStrategies.LEAST_BUSY } ) - // TODO: Create a better test to cover `LessBusyWorkerChoiceStrategy#choose` + // TODO: Create a better test to cover `LeastBusyWorkerChoiceStrategy#choose` const maxMultiplier = 2 for (let i = 0; i < max * maxMultiplier; i++) { await pool.execute() diff --git a/tests/pools/selection-strategies/worker-choice-strategy-context.test.js b/tests/pools/selection-strategies/worker-choice-strategy-context.test.js index fa380a5a..b36ec277 100644 --- a/tests/pools/selection-strategies/worker-choice-strategy-context.test.js +++ b/tests/pools/selection-strategies/worker-choice-strategy-context.test.js @@ -12,11 +12,11 @@ const { RoundRobinWorkerChoiceStrategy } = require('../../../lib/pools/selection-strategies/round-robin-worker-choice-strategy') const { - LessUsedWorkerChoiceStrategy -} = require('../../../lib/pools/selection-strategies/less-used-worker-choice-strategy') + LeastUsedWorkerChoiceStrategy +} = require('../../../lib/pools/selection-strategies/least-used-worker-choice-strategy') const { - LessBusyWorkerChoiceStrategy -} = require('../../../lib/pools/selection-strategies/less-busy-worker-choice-strategy') + LeastBusyWorkerChoiceStrategy +} = require('../../../lib/pools/selection-strategies/least-busy-worker-choice-strategy') const { FairShareWorkerChoiceStrategy } = require('../../../lib/pools/selection-strategies/fair-share-worker-choice-strategy') @@ -194,8 +194,8 @@ describe('Worker choice strategy context test suite', () => { ) }) - it('Verify that setWorkerChoiceStrategy() works with LESS_USED and fixed pool', () => { - const workerChoiceStrategy = WorkerChoiceStrategies.LESS_USED + it('Verify that setWorkerChoiceStrategy() works with LEAST_USED and fixed pool', () => { + const workerChoiceStrategy = WorkerChoiceStrategies.LEAST_USED const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( fixedPool ) @@ -204,14 +204,14 @@ describe('Worker choice strategy context test suite', () => { workerChoiceStrategyContext.workerChoiceStrategies.get( workerChoiceStrategy ) - ).toBeInstanceOf(LessUsedWorkerChoiceStrategy) + ).toBeInstanceOf(LeastUsedWorkerChoiceStrategy) expect(workerChoiceStrategyContext.workerChoiceStrategy).toBe( workerChoiceStrategy ) }) - it('Verify that setWorkerChoiceStrategy() works with LESS_USED and dynamic pool', () => { - const workerChoiceStrategy = WorkerChoiceStrategies.LESS_USED + it('Verify that setWorkerChoiceStrategy() works with LEAST_USED and dynamic pool', () => { + const workerChoiceStrategy = WorkerChoiceStrategies.LEAST_USED const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( dynamicPool ) @@ -220,14 +220,14 @@ describe('Worker choice strategy context test suite', () => { workerChoiceStrategyContext.workerChoiceStrategies.get( workerChoiceStrategy ) - ).toBeInstanceOf(LessUsedWorkerChoiceStrategy) + ).toBeInstanceOf(LeastUsedWorkerChoiceStrategy) expect(workerChoiceStrategyContext.workerChoiceStrategy).toBe( workerChoiceStrategy ) }) - it('Verify that setWorkerChoiceStrategy() works with LESS_BUSY and fixed pool', () => { - const workerChoiceStrategy = WorkerChoiceStrategies.LESS_BUSY + it('Verify that setWorkerChoiceStrategy() works with LEAST_BUSY and fixed pool', () => { + const workerChoiceStrategy = WorkerChoiceStrategies.LEAST_BUSY const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( fixedPool ) @@ -236,14 +236,14 @@ describe('Worker choice strategy context test suite', () => { workerChoiceStrategyContext.workerChoiceStrategies.get( workerChoiceStrategy ) - ).toBeInstanceOf(LessBusyWorkerChoiceStrategy) + ).toBeInstanceOf(LeastBusyWorkerChoiceStrategy) expect(workerChoiceStrategyContext.workerChoiceStrategy).toBe( workerChoiceStrategy ) }) - it('Verify that setWorkerChoiceStrategy() works with LESS_BUSY and dynamic pool', () => { - const workerChoiceStrategy = WorkerChoiceStrategies.LESS_BUSY + it('Verify that setWorkerChoiceStrategy() works with LEAST_BUSY and dynamic pool', () => { + const workerChoiceStrategy = WorkerChoiceStrategies.LEAST_BUSY const workerChoiceStrategyContext = new WorkerChoiceStrategyContext( dynamicPool ) @@ -252,7 +252,7 @@ describe('Worker choice strategy context test suite', () => { workerChoiceStrategyContext.workerChoiceStrategies.get( workerChoiceStrategy ) - ).toBeInstanceOf(LessBusyWorkerChoiceStrategy) + ).toBeInstanceOf(LeastBusyWorkerChoiceStrategy) expect(workerChoiceStrategyContext.workerChoiceStrategy).toBe( workerChoiceStrategy ) -- 2.34.1