repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
refactor: methods namepace cleanup
[poolifier.git]
/
src
/
pools
/
selection-strategies
/
round-robin-worker-choice-strategy.ts
diff --git
a/src/pools/selection-strategies/round-robin-worker-choice-strategy.ts
b/src/pools/selection-strategies/round-robin-worker-choice-strategy.ts
index fdf5ac84fddf87235b1d7732e81f2ccff3aae53b..b023234a202cacc50b8f2505859e4e444bcf8f0f 100644
(file)
--- a/
src/pools/selection-strategies/round-robin-worker-choice-strategy.ts
+++ b/
src/pools/selection-strategies/round-robin-worker-choice-strategy.ts
@@
-50,7
+50,9
@@
export class RoundRobinWorkerChoiceStrategy<
/** @inheritDoc */
public choose (): number {
const chosenWorkerNodeKey = this.nextWorkerNodeKey
/** @inheritDoc */
public choose (): number {
const chosenWorkerNodeKey = this.nextWorkerNodeKey
- this.roundRobinNextWorkerNodeKey()
+ do {
+ this.roundRobinNextWorkerNodeKey()
+ } while (!this.isWorkerNodeReady(this.nextWorkerNodeKey))
return chosenWorkerNodeKey
}
return chosenWorkerNodeKey
}
@@
-66,10
+68,11
@@
export class RoundRobinWorkerChoiceStrategy<
return true
}
return true
}
- private roundRobinNextWorkerNodeKey ():
void
{
+ private roundRobinNextWorkerNodeKey ():
number
{
this.nextWorkerNodeKey =
this.nextWorkerNodeKey === this.pool.workerNodes.length - 1
? 0
: this.nextWorkerNodeKey + 1
this.nextWorkerNodeKey =
this.nextWorkerNodeKey === this.pool.workerNodes.length - 1
? 0
: this.nextWorkerNodeKey + 1
+ return this.nextWorkerNodeKey
}
}
}
}