X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fpools%2Fselection-strategies%2Fleast-used-worker-choice-strategy.ts;h=c750c290d1d7f3c5039698a9be04a2971b623781;hb=aa1e0433fcfdc47175d6144524bcda57ab2947a1;hp=515b4e935db6e33fd5f3946c4f1b7cb0eb52a5f0;hpb=edc0cdb11d19cc5993ca98004a7dbbf49439acd8;p=poolifier.git 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 515b4e93..c750c290 100644 --- a/src/pools/selection-strategies/least-used-worker-choice-strategy.ts +++ b/src/pools/selection-strategies/least-used-worker-choice-strategy.ts @@ -42,8 +42,7 @@ export class LeastUsedWorkerChoiceStrategy< /** @inheritDoc */ public choose (): number | undefined { - const chosenWorkerNodeKey = this.leastUsedNextWorkerNodeKey() - this.assignChosenWorkerNodeKey(chosenWorkerNodeKey) + this.nextWorkerNodeKey = this.leastUsedNextWorkerNodeKey() return this.nextWorkerNodeKey } @@ -61,13 +60,10 @@ export class LeastUsedWorkerChoiceStrategy< workerTaskStatistics.executed + workerTaskStatistics.executing + workerTaskStatistics.queued - if (this.isWorkerNodeEligible(workerNodeKey) && workerTasks === 0) { + if (workerTasks === 0) { chosenWorkerNodeKey = workerNodeKey break - } else if ( - this.isWorkerNodeEligible(workerNodeKey) && - workerTasks < minNumberOfTasks - ) { + } else if (workerTasks < minNumberOfTasks) { minNumberOfTasks = workerTasks chosenWorkerNodeKey = workerNodeKey }