refactor: align methods signature
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 10 Apr 2023 09:53:44 +0000 (11:53 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 10 Apr 2023 09:53:44 +0000 (11:53 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/pools/abstract-pool.ts
src/pools/selection-strategies/abstract-worker-choice-strategy.ts

index fea4847d685c1c60433b55a321c83f30dee20abf..a840dc740116057f8fa7867f85348a676caf04a4 100644 (file)
@@ -544,8 +544,8 @@ export abstract class AbstractPool<
     this.sendToWorker(this.workerNodes[workerNodeKey].worker, task)
   }
 
-  private enqueueTask (workerNodeKey: number, task: Task<Data>): void {
-    this.workerNodes[workerNodeKey].tasksQueue.push(task)
+  private enqueueTask (workerNodeKey: number, task: Task<Data>): number {
+    return this.workerNodes[workerNodeKey].tasksQueue.push(task)
   }
 
   private dequeueTask (workerNodeKey: number): Task<Data> | undefined {
index 31041f3a8783c605d237196f7e89920d04dd27bb..1da5dc52ee69537e5a828a23c74262246867316b 100644 (file)
@@ -38,13 +38,13 @@ export abstract class AbstractWorkerChoiceStrategy<
     protected readonly pool: IPoolInternal<Worker, Data, Response>,
     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
     }
   }