From d62fc5e18631cc99b49c6792c00dc36fa70339e0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Tue, 19 Dec 2023 23:50:33 +0100 Subject: [PATCH] refactor: remove unneeded type casting MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .../abstract-worker-choice-strategy.ts | 3 +-- .../selection-strategies/worker-choice-strategy-context.ts | 7 ++----- 2 files changed, 3 insertions(+), 7 deletions(-) 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 } -- 2.34.1