-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reconnect strategy not being used and ready event fired without being ready. #2120
Comments
This code does not reproduce the issue, am I missing something? import { createClient } from '@redis/client';
const client = createClient({
socket: {
reconnectStrategy() {
console.log('reconnectStrategy', new Date().toJSON());
return 5000;
}
}
})
.on('connect', () => console.log('connect', new Date().toJSON()))
.on('ready', () => console.log('ready', new Date().toJSON()))
.on('error', err => console.error('error', err, new Date().toJSON()));
try {
await client.connect();
} catch (err) {
console.error('connect err', err, new Date().toJSON());
} |
Thanks for your reply. I tried a bit with your code and found some things out. It seems to work when I use a local redis service and start/stop it using However I work with kubernetes a lot and my redis server is port forwarded to my localhost as follows: When I connect to this redis instance reconnectstrategy does not work The error for local redis instance is:
The error for port forwarded redis instance is:
|
Also when I get this error it doesn't listen to reconnectstrategy
|
with |
So to me sounds like reconnectstrategy should be incorporated into this error flow as well. No? EDIT: Anyway I did more testing and it seems that literally just changing the port causes the error to go from ECONNREFUSED to ECONNRESET. When I run the same piece of code you provided just adding I started investigating and found out that there is something called afs-fileserver ruinning on my PC on port 7000. However, that makes me think that node-redis does not handle other kinds of disconnects properly? When can |
|
I meet the same problem, when some error happened , the time that i set for reconnectStrategy dont work . |
#2274 maybe It could solve your question |
did anyone have a work around for this issue? |
@GeekOnGadgets to my understanding there is no issue (see this comment).. wanna share a little bit more? |
@leibale In Redis 4.5.1, I discovered that the |
I've recently upgraded to node redis 4.1.0 and I'm having issues with reconnectStrategy and connection handling in general.
Logs from reconnectstrategy are never printed.
When I start with redis server down. I still get the ready event triggered. A bit later I get an error event and it immediately "connects" (triggering ready again); And this just continues; The 5 second reconnect timer is not used.
When redis is online when I start the application and I later turn it off: it seems to go even faster. It does not wait long between the ready event and an error.
I'm initializing redis like so:
Environment:
The text was updated successfully, but these errors were encountered: