- private workerLastVirtualTaskTimestamp: Map<
- Worker,
- WorkerVirtualTaskTimestamp
- > = new Map<Worker, WorkerVirtualTaskTimestamp>()
+ private workersVirtualTaskEndTimestamp: number[] = []
+
+ /** @inheritDoc */
+ public constructor (
+ pool: IPool<Worker, Data, Response>,
+ opts: WorkerChoiceStrategyOptions = DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS
+ ) {
+ super(pool, opts)
+ this.setTaskStatisticsRequirements(this.opts)
+ }
+
+ /** @inheritDoc */
+ public reset (): boolean {
+ this.workersVirtualTaskEndTimestamp = []
+ return true
+ }
+
+ /** @inheritDoc */
+ public update (workerNodeKey: number): boolean {
+ this.computeWorkerVirtualTaskEndTimestamp(workerNodeKey)
+ return true
+ }
+
+ /** @inheritDoc */
+ public choose (): number | undefined {
+ this.setPreviousWorkerNodeKey(this.nextWorkerNodeKey)
+ this.nextWorkerNodeKey = this.fairShareNextWorkerNodeKey()
+ return this.nextWorkerNodeKey
+ }