From: Jérôme Benoit Date: Mon, 10 Apr 2023 09:53:44 +0000 (+0200) Subject: refactor: align methods signature X-Git-Tag: v2.4.6~3 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=f9f00b5f18805c14b1bac3b2e5d2e8b5abc6c66c;p=poolifier.git refactor: align methods signature Signed-off-by: Jérôme Benoit --- diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index fea4847d..a840dc74 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -544,8 +544,8 @@ export abstract class AbstractPool< this.sendToWorker(this.workerNodes[workerNodeKey].worker, task) } - private enqueueTask (workerNodeKey: number, task: Task): void { - this.workerNodes[workerNodeKey].tasksQueue.push(task) + private enqueueTask (workerNodeKey: number, task: Task): number { + return this.workerNodes[workerNodeKey].tasksQueue.push(task) } private dequeueTask (workerNodeKey: number): Task | undefined { diff --git a/src/pools/selection-strategies/abstract-worker-choice-strategy.ts b/src/pools/selection-strategies/abstract-worker-choice-strategy.ts index 31041f3a..1da5dc52 100644 --- a/src/pools/selection-strategies/abstract-worker-choice-strategy.ts +++ b/src/pools/selection-strategies/abstract-worker-choice-strategy.ts @@ -38,13 +38,13 @@ export abstract class AbstractWorkerChoiceStrategy< protected readonly pool: IPoolInternal, protected readonly opts: WorkerChoiceStrategyOptions = { medRunTime: false } ) { - this.checkOptions() + this.checkOptions(this.opts) this.isDynamicPool = this.pool.type === PoolType.DYNAMIC this.choose.bind(this) } - private checkOptions (): void { - if (this.requiredStatistics.avgRunTime && this.opts.medRunTime === true) { + private checkOptions (opts: WorkerChoiceStrategyOptions): void { + if (this.requiredStatistics.avgRunTime && opts.medRunTime === true) { this.requiredStatistics.medRunTime = true } }