repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
chore: v2.6.40
[poolifier.git]
/
src
/
pools
/
selection-strategies
/
weighted-round-robin-worker-choice-strategy.ts
diff --git
a/src/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.ts
b/src/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.ts
index 42952fa2c3d08534ea08595080cfa2860693e6b6..b023bfb0cd258641354c81c465c20fa9a3b0b309 100644
(file)
--- a/
src/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.ts
+++ b/
src/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.ts
@@
-76,13
+76,20
@@
export class WeightedRoundRobinWorkerChoiceStrategy<
/** @inheritDoc */
public remove (workerNodeKey: number): boolean {
/** @inheritDoc */
public remove (workerNodeKey: number): boolean {
+ if (this.pool.workerNodes.length === 0) {
+ this.reset()
+ }
if (this.nextWorkerNodeKey === workerNodeKey) {
if (this.nextWorkerNodeKey === workerNodeKey) {
- if (this.pool.workerNodes.length === 0) {
- this.nextWorkerNodeKey = 0
- } else if (this.nextWorkerNodeKey > this.pool.workerNodes.length - 1) {
+ this.workerVirtualTaskRunTime = 0
+ if (this.nextWorkerNodeKey > this.pool.workerNodes.length - 1) {
this.nextWorkerNodeKey = this.pool.workerNodes.length - 1
}
this.nextWorkerNodeKey = this.pool.workerNodes.length - 1
}
- this.workerVirtualTaskRunTime = 0
+ }
+ if (
+ this.previousWorkerNodeKey === workerNodeKey &&
+ this.previousWorkerNodeKey > this.pool.workerNodes.length - 1
+ ) {
+ this.previousWorkerNodeKey = this.pool.workerNodes.length - 1
}
return true
}
}
return true
}