Merge branch 'master' into interleaved-weighted-round-robin-worker-choice-strategy
[poolifier.git] / src / pools / selection-strategies / round-robin-worker-choice-strategy.ts
index 5e35636af62e77d5b56720344c14c274a0c0a97e..be4fe3326b9585c8bd4f7261023cda4fe5af710e 100644 (file)
@@ -32,7 +32,7 @@ export class RoundRobinWorkerChoiceStrategy<
     opts: WorkerChoiceStrategyOptions = DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS
   ) {
     super(pool, opts)
-    this.checkOptions(this.opts)
+    this.setRequiredStatistics(this.opts)
   }
 
   /** @inheritDoc */
@@ -61,11 +61,8 @@ export class RoundRobinWorkerChoiceStrategy<
     if (this.nextWorkerNodeId === workerNodeKey) {
       if (this.pool.workerNodes.length === 0) {
         this.nextWorkerNodeId = 0
-      } else {
-        this.nextWorkerNodeId =
-          this.nextWorkerNodeId > this.pool.workerNodes.length - 1
-            ? this.pool.workerNodes.length - 1
-            : this.nextWorkerNodeId
+      } else if (this.nextWorkerNodeId > this.pool.workerNodes.length - 1) {
+        this.nextWorkerNodeId = this.pool.workerNodes.length - 1
       }
     }
     return true