From: Jérôme Benoit Date: Tue, 19 Dec 2023 22:50:33 +0000 (+0100) Subject: refactor: remove unneeded type casting X-Git-Tag: v3.1.7~1^2~19 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=d62fc5e18631cc99b49c6792c00dc36fa70339e0;p=poolifier.git refactor: remove unneeded type casting Signed-off-by: Jérôme Benoit --- diff --git a/src/pools/selection-strategies/abstract-worker-choice-strategy.ts b/src/pools/selection-strategies/abstract-worker-choice-strategy.ts index 7324c511..b15ade84 100644 --- a/src/pools/selection-strategies/abstract-worker-choice-strategy.ts +++ b/src/pools/selection-strategies/abstract-worker-choice-strategy.ts @@ -114,8 +114,7 @@ export abstract class AbstractWorkerChoiceStrategy< public setOptions (opts: InternalWorkerChoiceStrategyOptions): void { this.opts = { ...getDefaultInternalWorkerChoiceStrategyOptions( - this.pool.info.maxSize + - Object.keys((opts?.weights as Record) ?? {}).length + this.pool.info.maxSize + Object.keys(opts?.weights ?? {}).length ), ...opts } diff --git a/src/pools/selection-strategies/worker-choice-strategy-context.ts b/src/pools/selection-strategies/worker-choice-strategy-context.ts index cf1b0051..6f15daa0 100644 --- a/src/pools/selection-strategies/worker-choice-strategy-context.ts +++ b/src/pools/selection-strategies/worker-choice-strategy-context.ts @@ -48,9 +48,7 @@ export class WorkerChoiceStrategyContext< ) { this.opts = { ...getDefaultInternalWorkerChoiceStrategyOptions( - pool.info.maxSize + - Object.keys((this.opts?.weights as Record) ?? {}) - .length + pool.info.maxSize + Object.keys(this.opts?.weights ?? {}).length ), ...this.opts } @@ -237,8 +235,7 @@ export class WorkerChoiceStrategyContext< ): void { this.opts = { ...getDefaultInternalWorkerChoiceStrategyOptions( - pool.info.maxSize + - Object.keys((opts?.weights as Record) ?? {}).length + pool.info.maxSize + Object.keys(opts?.weights ?? {}).length ), ...opts }