node-redis
node-redis copied to clipboard
disconnect() after connect() does not stop client reconnection attempt.
Description
Related to #2010.
- If I try client connect but it fails to connect to any server and throws error events with:
Error: connect ECONNREFUSED ::1:6379
. - redis.disconnect() does not stop those reconnection attempts.
Node.js Version
18.18.0
Redis Server Version
7.2
Node Redis Version
4.6.10
Platform
MacOS
Logs
No response
it try to reconnect maybe because you use retrystrategy as option :
new Redis({
retryStrategy: (times) => {
const maxDelay = 5000; // Maximum delay between reconnection attempts (in milliseconds)
const delay = Math.min(times * 1000, maxDelay);
console.error(Redis connection lost. Reconnecting in ${delay}ms...
);
return delay;
}});`
can't reproduce it, can you pls share an example ? i thought that the fix was merged here by @leibale