repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
test: add tests for worker choice strategies using median run time
[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 665022c79aebaf4596e306b7975aa7c0c7f3d923..dc2e5df3f170a1c8d65118e705d6b0754cebf56b 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
@@
-7,6
+7,7
@@
import type {
WorkerChoiceStrategyOptions
} from './selection-strategies-types'
import type { IPool } from '../pool'
WorkerChoiceStrategyOptions
} from './selection-strategies-types'
import type { IPool } from '../pool'
+import { DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS } from '../../utils'
/**
* Virtual task runtime.
/**
* Virtual task runtime.
@@
-54,17
+55,13
@@
export class WeightedRoundRobinWorkerChoiceStrategy<
TaskRunTime
>()
TaskRunTime
>()
- /**
- * Constructs a worker choice strategy that selects with a weighted round robin scheduling algorithm.
- *
- * @param pool - The pool instance.
- * @param opts - The worker choice strategy options.
- */
+ /** @inheritDoc */
public constructor (
pool: IPool<Worker, Data, Response>,
public constructor (
pool: IPool<Worker, Data, Response>,
- opts
?: WorkerChoiceStrategyOptions
+ opts
: WorkerChoiceStrategyOptions = DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS
) {
super(pool, opts)
) {
super(pool, opts)
+ this.checkOptions(opts)
this.defaultWorkerWeight = this.computeWorkerWeight()
this.initWorkersTaskRunTime()
}
this.defaultWorkerWeight = this.computeWorkerWeight()
this.initWorkersTaskRunTime()
}