reconnectOnError not working
weilinzung opened this issue · comments
Wei commented
Can someone verify if this reconnectOnError
is working at all?
"ioredis": "5.3.2"
const redis = new Redis({
host: host,
port: port,
reconnectOnError: (error: Error & { code?: string }) => {
// Only reconnect when "ECONNRESET" is occurred
if (error?.code === 'ECONNRESET') {
console.warn(
`Redis connection occurred ${error.message}, retrying...`
);
return 2;
}
console.error(
`Redis connection error, ${error?.code}, ${error.message}`
);
return false;
}
})
redis.on('error', (error: Error & { code?: string }) => {
console.error(`Redis error listener, ${error?.code}, ${error.message}`);
});
I tried to log in when the error happened but I don't see any logs from above callBack.