/** @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
}
}
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(