repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #773 from poolifier/elu-strategy
[poolifier.git]
/
src
/
pools
/
selection-strategies
/
least-used-worker-choice-strategy.ts
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 d9e3c20e1d56e951238cdbfc47ab2c4698ca999a..4161a1d266634518c5800d57a421acb46b690fe6 100644
(file)
--- 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)
opts: WorkerChoiceStrategyOptions = DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS
) {
super(pool, opts)
- this.setTaskStatistics(this.opts)
+ this.setTaskStatistics
Requirements
(this.opts)
}
/** @inheritDoc */
}
/** @inheritDoc */
@@
-49,8
+49,11
@@
export class LeastUsedWorkerChoiceStrategy<
let minNumberOfTasks = Infinity
let leastUsedWorkerNodeKey!: number
for (const [workerNodeKey, workerNode] of this.pool.workerNodes.entries()) {
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) {
if (workerTasks === 0) {
return workerNodeKey
} else if (workerTasks < minNumberOfTasks) {