repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix: avoid out of bound at worker node removal
[poolifier.git]
/
src
/
pools
/
selection-strategies
/
fair-share-worker-choice-strategy.ts
diff --git
a/src/pools/selection-strategies/fair-share-worker-choice-strategy.ts
b/src/pools/selection-strategies/fair-share-worker-choice-strategy.ts
index fc4bd1fd4de4f281c8dbae20fcf3014ca0a5565f..c4a0d30beb7fe827d614ca9f434c7470aeb9d018 100644
(file)
--- a/
src/pools/selection-strategies/fair-share-worker-choice-strategy.ts
+++ b/
src/pools/selection-strategies/fair-share-worker-choice-strategy.ts
@@
-70,6
+70,7
@@
export class FairShareWorkerChoiceStrategy<
/** @inheritDoc */
public choose (): number | undefined {
/** @inheritDoc */
public choose (): number | undefined {
+ this.setPreviousWorkerNodeKey(this.nextWorkerNodeKey)
this.nextWorkerNodeKey = this.fairShareNextWorkerNodeKey()
return this.nextWorkerNodeKey
}
this.nextWorkerNodeKey = this.fairShareNextWorkerNodeKey()
return this.nextWorkerNodeKey
}
@@
-81,12
+82,9
@@
export class FairShareWorkerChoiceStrategy<
}
private fairShareNextWorkerNodeKey (): number | undefined {
}
private fairShareNextWorkerNodeKey (): number | undefined {
- let minWorkerVirtualTaskEndTimestamp = Infinity
let chosenWorkerNodeKey: number | undefined
let chosenWorkerNodeKey: number | undefined
+ let minWorkerVirtualTaskEndTimestamp = Infinity
for (const [workerNodeKey] of this.pool.workerNodes.entries()) {
for (const [workerNodeKey] of this.pool.workerNodes.entries()) {
- if (!this.isWorkerNodeEligible(workerNodeKey)) {
- continue
- }
if (this.workersVirtualTaskEndTimestamp[workerNodeKey] == null) {
this.computeWorkerVirtualTaskEndTimestamp(workerNodeKey)
}
if (this.workersVirtualTaskEndTimestamp[workerNodeKey] == null) {
this.computeWorkerVirtualTaskEndTimestamp(workerNodeKey)
}