refactor: align pool setters signature
authorJérôme Benoit <jerome.benoit@sap.com>
Sat, 15 Apr 2023 12:07:52 +0000 (14:07 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sat, 15 Apr 2023 12:07:52 +0000 (14:07 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/pools/abstract-pool.ts
src/pools/pool.ts

index f1c6ad13af6ea51de124cfb8545c65e2af5e01e8..9290c2185e05f62137e7df7784f881988d02b022 100644 (file)
@@ -216,7 +216,8 @@ export abstract class AbstractPool<
 
   /** @inheritDoc */
   public setWorkerChoiceStrategy (
-    workerChoiceStrategy: WorkerChoiceStrategy
+    workerChoiceStrategy: WorkerChoiceStrategy,
+    workerChoiceStrategyOptions?: WorkerChoiceStrategyOptions
   ): void {
     this.checkValidWorkerChoiceStrategy(workerChoiceStrategy)
     this.opts.workerChoiceStrategy = workerChoiceStrategy
@@ -234,6 +235,9 @@ export abstract class AbstractPool<
     this.workerChoiceStrategyContext.setWorkerChoiceStrategy(
       this.opts.workerChoiceStrategy
     )
+    if (workerChoiceStrategyOptions != null) {
+      this.setWorkerChoiceStrategyOptions(workerChoiceStrategyOptions)
+    }
   }
 
   /** @inheritDoc */
index ea60833a42b445921ef162d15d651a9ba32d6127..a0663ba523a765878a4566aafe7a667b9ab220f2 100644 (file)
@@ -163,8 +163,12 @@ export interface IPool<
    * Sets the worker choice strategy in this pool.
    *
    * @param workerChoiceStrategy - The worker choice strategy.
+   * @param workerChoiceStrategyOptions - The worker choice strategy options.
    */
-  setWorkerChoiceStrategy: (workerChoiceStrategy: WorkerChoiceStrategy) => void
+  setWorkerChoiceStrategy: (
+    workerChoiceStrategy: WorkerChoiceStrategy,
+    workerChoiceStrategyOptions?: WorkerChoiceStrategyOptions
+  ) => void
   /**
    * Sets the worker choice strategy options in this pool.
    *