-import { DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS } from '../../utils'
-import type { IPool } from '../pool'
-import type { IWorker } from '../worker'
-import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy'
+import type { IPool } from '../pool.js'
+import { DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS } from '../utils.js'
+import type { IWorker } from '../worker.js'
+import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy.js'
import type {
IWorkerChoiceStrategy,
- InternalWorkerChoiceStrategyOptions,
- TaskStatisticsRequirements
-} from './selection-strategies-types'
+ TaskStatisticsRequirements,
+ WorkerChoiceStrategyOptions
+} from './selection-strategies-types.js'
/**
* Selects the least busy worker.
/** @inheritDoc */
public constructor (
pool: IPool<Worker, Data, Response>,
- opts: InternalWorkerChoiceStrategyOptions
+ opts?: WorkerChoiceStrategyOptions
) {
super(pool, opts)
this.setTaskStatisticsRequirements(this.opts)
return this.pool.workerNodes.reduce(
(minWorkerNodeKey, workerNode, workerNodeKey, workerNodes) => {
return this.isWorkerNodeReady(workerNodeKey) &&
- (workerNode.usage.runTime.aggregate ?? 0) +
- (workerNode.usage.waitTime.aggregate ?? 0) <
- (workerNodes[minWorkerNodeKey].usage.runTime.aggregate ?? 0) +
- (workerNodes[minWorkerNodeKey].usage.waitTime.aggregate ?? 0)
+ (workerNode.usage.waitTime.aggregate ?? 0) +
+ (workerNode.usage.runTime.aggregate ?? 0) <
+ (workerNodes[minWorkerNodeKey].usage.waitTime.aggregate ?? 0) +
+ (workerNodes[minWorkerNodeKey].usage.runTime.aggregate ?? 0)
? workerNodeKey
: minWorkerNodeKey
},