From 4ac97eeaacceb7f0710e10bb020f8793b37cf820 Mon Sep 17 00:00:00 2001 From: Max Gruenfelder Date: Tue, 2 Jul 2024 18:00:27 +0200 Subject: [PATCH] fix createCluster - copy `options.defaults.socket` before modifying it (#2783) * shallow copy of this.#options.defaults.socket * shallow copy of this.#options.defaults.socket * nit --------- Co-authored-by: Max Gruenfelder Co-authored-by: Leibale Eidelman --- packages/client/lib/cluster/cluster-slots.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/client/lib/cluster/cluster-slots.ts b/packages/client/lib/cluster/cluster-slots.ts index 489ded4854..45c96a80b5 100644 --- a/packages/client/lib/cluster/cluster-slots.ts +++ b/packages/client/lib/cluster/cluster-slots.ts @@ -269,10 +269,10 @@ export default class RedisClusterSlots< if (this.#options.defaults) { let socket; if (this.#options.defaults.socket) { - socket = options?.socket ? { + socket = { ...this.#options.defaults.socket, - ...options.socket - } : this.#options.defaults.socket; + ...options?.socket + }; } else { socket = options?.socket; }