https://github.com/redis/node-redis/pull/2373 introduced a bug into the creation of cluster clients. The issue is that provided options for creating a socket are changed. The function clientOptionsDefaults in cluster-slots.ts is called twice once with disableReconnectfalse and the second call is the real call for creating clients but the function clientOptionsDefaults is overriding this.#options.defaults.socket at line 289 because result.socket is the same reference as this.#options.defaults.socket
Description
https://github.com/redis/node-redis/pull/2373 introduced a bug into the creation of cluster clients. The issue is that provided options for creating a socket are changed. The function
clientOptionsDefaults
incluster-slots.ts
is called twice once withdisableReconnect
false
and the second call is the real call for creating clients but the functionclientOptionsDefaults
is overridingthis.#options.defaults.socket
at line 289 becauseresult.socket
is the same reference asthis.#options.defaults.socket
fix https://github.com/redis/node-redis/issues/2721
Checklist
npm test
pass with this change (including linting)?