From 244354f75da244b1f6ee9be246c4282e60e69a76 Mon Sep 17 00:00:00 2001 From: Higor Augusto Madureira Date: Wed, 14 Aug 2024 14:37:32 -0300 Subject: [PATCH] fix: #2522 max call stack size exceeded on MSET function with several arguments --- packages/client/lib/commands/MSET.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/client/lib/commands/MSET.ts b/packages/client/lib/commands/MSET.ts index bd7111659d1..49eb067bfa3 100644 --- a/packages/client/lib/commands/MSET.ts +++ b/packages/client/lib/commands/MSET.ts @@ -8,17 +8,17 @@ export type MSetArguments = Record; export function transformArguments(toSet: MSetArguments): RedisCommandArguments { - const args: RedisCommandArguments = ['MSET']; if (Array.isArray(toSet)) { - args.push(...toSet.flat()); + return ['MSET', ...toSet.flat()] } else { + const args: RedisCommandArguments = ['MSET']; for (const key of Object.keys(toSet)) { args.push(key, toSet[key]); } + return args; } - return args; } export declare function transformReply(): RedisCommandArgument;