fix: fix faire share worker choice stategy internals update
[poolifier.git] / src / pools / selection-strategies / round-robin-worker-choice-strategy.ts
index 80e958a406fa2209ce1c20eded5b8e9b79e9ca0b..5e35636af62e77d5b56720344c14c274a0c0a97e 100644 (file)
@@ -1,6 +1,11 @@
+import { DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS } from '../../utils'
+import type { IPool } from '../pool'
 import type { IWorker } from '../worker'
 import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy'
-import type { IWorkerChoiceStrategy } from './selection-strategies-types'
+import type {
+  IWorkerChoiceStrategy,
+  WorkerChoiceStrategyOptions
+} from './selection-strategies-types'
 
 /**
  * Selects the next worker in a round robin fashion.
@@ -21,12 +26,26 @@ export class RoundRobinWorkerChoiceStrategy<
    */
   private nextWorkerNodeId: number = 0
 
+  /** @inheritDoc */
+  public constructor (
+    pool: IPool<Worker, Data, Response>,
+    opts: WorkerChoiceStrategyOptions = DEFAULT_WORKER_CHOICE_STRATEGY_OPTIONS
+  ) {
+    super(pool, opts)
+    this.checkOptions(this.opts)
+  }
+
   /** @inheritDoc */
   public reset (): boolean {
     this.nextWorkerNodeId = 0
     return true
   }
 
+  /** @inheritDoc */
+  public update (): boolean {
+    return true
+  }
+
   /** @inheritDoc */
   public choose (): number {
     const chosenWorkerNodeKey = this.nextWorkerNodeId