Merge pull request #878 from poolifier/dependabot/npm_and_yarn/examples/typescript...
[poolifier.git] / src / pools / selection-strategies / round-robin-worker-choice-strategy.ts
index b6d222f59995c523770120d515571bdb8c129b54..7968e621d49df510c06ad2bd4899b56770b3b163 100644 (file)
@@ -4,7 +4,6 @@ import type { IWorker } from '../worker'
 import { AbstractWorkerChoiceStrategy } from './abstract-worker-choice-strategy'
 import type {
   IWorkerChoiceStrategy,
-  StrategyPolicy,
   WorkerChoiceStrategyOptions
 } from './selection-strategies-types'
 
@@ -22,12 +21,6 @@ export class RoundRobinWorkerChoiceStrategy<
   >
   extends AbstractWorkerChoiceStrategy<Worker, Data, Response>
   implements IWorkerChoiceStrategy {
-  /** @inheritDoc */
-  public readonly strategyPolicy: StrategyPolicy = {
-    dynamicWorkerUsage: false,
-    dynamicWorkerReady: true
-  }
-
   /** @inheritDoc */
   public constructor (
     pool: IPool<Worker, Data, Response>,
@@ -52,11 +45,7 @@ export class RoundRobinWorkerChoiceStrategy<
   public choose (): number | undefined {
     const chosenWorkerNodeKey = this.nextWorkerNodeKey
     this.roundRobinNextWorkerNodeKey()
-    if (!this.isWorkerNodeEligible(this.nextWorkerNodeKey as number)) {
-      this.nextWorkerNodeKey = undefined
-      this.previousWorkerNodeKey =
-        chosenWorkerNodeKey ?? this.previousWorkerNodeKey
-    }
+    this.checkNextWorkerNodeEligibility(chosenWorkerNodeKey)
     return chosenWorkerNodeKey
   }