Properly integrate standard JS tools for JS and TS code
[poolifier.git] / src / pools / selection-strategies / weighted-round-robin-worker-choice-strategy.ts
index 4b1e5382af333d2edb59eb5ae41d1c5132f6ccb3..9bd5a07b3b5fa761ef4fd28993b4078568fef346 100644 (file)
@@ -7,7 +7,7 @@ import type { RequiredStatistics } from './selection-strategies-types'
 /**
  * Virtual task runtime.
  */
-type TaskRunTime = {
+interface TaskRunTime {
   weight: number
   runTime: number
 }
@@ -42,8 +42,8 @@ export class WeightedRoundRobinWorkerChoiceStrategy<
    * Per worker virtual task runtime map.
    */
   private readonly workersTaskRunTime: Map<Worker, TaskRunTime> = new Map<
-    Worker,
-    TaskRunTime
+  Worker,
+  TaskRunTime
   >()
 
   /**
@@ -68,10 +68,7 @@ export class WeightedRoundRobinWorkerChoiceStrategy<
   /** @inheritDoc */
   public choose (): Worker {
     const chosenWorker = this.pool.workers[this.currentWorkerIndex]
-    if (
-      this.isDynamicPool === true &&
-      this.workersTaskRunTime.has(chosenWorker) === false
-    ) {
+    if (this.isDynamicPool && !this.workersTaskRunTime.has(chosenWorker)) {
       this.initWorkerTaskRunTime(chosenWorker)
     }
     const workerTaskRunTime =