node-redis icon indicating copy to clipboard operation
node-redis copied to clipboard

disconnect() after connect() does not stop client reconnection attempt.

Open hkroger opened this issue 1 year ago • 2 comments

Description

Related to #2010.

  1. If I try client connect but it fails to connect to any server and throws error events with: Error: connect ECONNREFUSED ::1:6379.
  2. 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

hkroger avatar Sep 26 '23 16:09 hkroger

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; }});`

Iyadchafroud avatar Oct 03 '23 20:10 Iyadchafroud

can't reproduce it, can you pls share an example ? i thought that the fix was merged here by @leibale

DjellalAbdou avatar Jan 11 '24 13:01 DjellalAbdou