From: Jérôme Benoit Date: Sat, 15 Apr 2023 12:07:52 +0000 (+0200) Subject: refactor: align pool setters signature X-Git-Tag: v2.4.9~15 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=59219cbb5238cb64af71637ef062f537b63c55c8;p=poolifier.git refactor: align pool setters signature Signed-off-by: Jérôme Benoit --- diff --git a/src/pools/abstract-pool.ts b/src/pools/abstract-pool.ts index f1c6ad13..9290c218 100644 --- a/src/pools/abstract-pool.ts +++ b/src/pools/abstract-pool.ts @@ -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 */ diff --git a/src/pools/pool.ts b/src/pools/pool.ts index ea60833a..a0663ba5 100644 --- a/src/pools/pool.ts +++ b/src/pools/pool.ts @@ -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. *