repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
refactor: cleanup worker usage statistics code
[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 55fa8ad73d4c7b7713a490cf07265e3634803779..41bc4085ebd5a1399975e48e873fc0612c6a611c 100644
(file)
--- a/
src/pools/selection-strategies/round-robin-worker-choice-strategy.ts
+++ b/
src/pools/selection-strategies/round-robin-worker-choice-strategy.ts
@@
-24,7
+24,8
@@
export class RoundRobinWorkerChoiceStrategy<
implements IWorkerChoiceStrategy {
/** @inheritDoc */
public readonly strategyPolicy: StrategyPolicy = {
implements IWorkerChoiceStrategy {
/** @inheritDoc */
public readonly strategyPolicy: StrategyPolicy = {
- useDynamicWorker: true
+ dynamicWorkerUsage: false,
+ dynamicWorkerReady: true
}
/** @inheritDoc */
}
/** @inheritDoc */
@@
-48,11
+49,12
@@
export class RoundRobinWorkerChoiceStrategy<
}
/** @inheritDoc */
}
/** @inheritDoc */
- public choose (): number {
+ public choose (): number
| undefined
{
const chosenWorkerNodeKey = this.nextWorkerNodeKey
const chosenWorkerNodeKey = this.nextWorkerNodeKey
- do {
- this.roundRobinNextWorkerNodeKey()
- } while (!this.isWorkerNodeEligible(this.nextWorkerNodeKey))
+ this.roundRobinNextWorkerNodeKey()
+ if (!this.isWorkerNodeEligible(this.nextWorkerNodeKey as number)) {
+ this.nextWorkerNodeKey = undefined
+ }
return chosenWorkerNodeKey
}
return chosenWorkerNodeKey
}
@@
-68,11
+70,11
@@
export class RoundRobinWorkerChoiceStrategy<
return true
}
return true
}
- private roundRobinNextWorkerNodeKey (): number {
+ private roundRobinNextWorkerNodeKey (): number
| undefined
{
this.nextWorkerNodeKey =
this.nextWorkerNodeKey === this.pool.workerNodes.length - 1
? 0
this.nextWorkerNodeKey =
this.nextWorkerNodeKey === this.pool.workerNodes.length - 1
? 0
- :
this.nextWorkerNodeKey
+ 1
+ :
(this.nextWorkerNodeKey ?? 0)
+ 1
return this.nextWorkerNodeKey
}
}
return this.nextWorkerNodeKey
}
}