You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As I commented on #2032, I discovered that if the reconnecting event listener throws an error, it will silently prevent reconnection from happening. No error message will be logged, and there is no indication anything has gone wrong except that it just doesn't ever attempt to reconnect. I think it would be helpful if an error message was logged in this situation and the reconnection was able to proceed.
This is easiest to reproduce using Heroku's Redis server, which by default closes all connections after 5 minutes of inactivity.
Environment:
Node.js Version: 16.15.1
Redis Server Version: 6.2.3 (Heroku)
Node Redis Version: 4.2.0
Platform: MacOS 12.5
Reproducer:
import{createClient}from"redis";exportconstclient=createClient({url: process.env.REDIS_URL});client.on('error',err=>console.log(`Redis error: ${err}`));// the below line works fine//client.on('reconnecting', () => console.log('Redis reconnecting'));// the below line causes an error, which is swallowed and silently prevents reconnectclient.on('reconnecting',(foo)=>console.log('Redis reconnecting'+foo.bar));client.on('connect',()=>console.log('Redis connected'));client.on('ready',()=>console.log('Redis ready'));client.on('end',()=>console.log('Redis connection closed'));awaitclient.connect();
As I commented on #2032, I discovered that if the
reconnecting
event listener throws an error, it will silently prevent reconnection from happening. No error message will be logged, and there is no indication anything has gone wrong except that it just doesn't ever attempt to reconnect. I think it would be helpful if an error message was logged in this situation and the reconnection was able to proceed.This is easiest to reproduce using Heroku's Redis server, which by default closes all connections after 5 minutes of inactivity.
Environment:
Reproducer:
Output in the broken case:
Output in the working case (uncomment the working line and comment the broken line):
Thank you.
The text was updated successfully, but these errors were encountered: