test: refine expectation
[poolifier.git] / src / pools / selection-strategies / weighted-round-robin-worker-choice-strategy.ts
index fea72350ffafbb50b44f9a56935f17038952ef91..5338b320b0586bab67195ed5b93e23a0e74cd2f0 100644 (file)
@@ -34,10 +34,6 @@ export class WeightedRoundRobinWorkerChoiceStrategy<
     elu: DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS
   }
 
-  /**
-   * Default worker weight.
-   */
-  private readonly defaultWorkerWeight: number
   /**
    * Worker node virtual task runtime.
    */
@@ -50,7 +46,6 @@ export class WeightedRoundRobinWorkerChoiceStrategy<
   ) {
     super(pool, opts)
     this.setTaskStatisticsRequirements(this.opts)
-    this.defaultWorkerWeight = this.computeDefaultWorkerWeight()
   }
 
   /** @inheritDoc */
@@ -94,10 +89,9 @@ export class WeightedRoundRobinWorkerChoiceStrategy<
   }
 
   private weightedRoundRobinNextWorkerNodeKey (): number | undefined {
-    const workerWeight =
-      this.opts.weights?.[
-        this.nextWorkerNodeKey ?? this.previousWorkerNodeKey
-      ] ?? this.defaultWorkerWeight
+    const workerWeight = this.opts.weights?.[
+      this.nextWorkerNodeKey ?? this.previousWorkerNodeKey
+    ] as number
     if (this.workerNodeVirtualTaskRunTime < workerWeight) {
       this.workerNodeVirtualTaskRunTime =
         this.workerNodeVirtualTaskRunTime +