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
What's the recommended strategy for error handling?
So my understanding is that there's no need for me to do anything.
The default reconnection strategy of Redis is enough.
My question would be, do I need to throw in some handler? Do I want to fail-fast and crash the server process on end? Not entirely sure. Any advice welcome.
Here's the whole of my conn. code. Just wanna make sure I set this up as robustly as possible.
constredis=newRedis(url)redis.on('ready',()=>{// ready to accept connectionsconsole.log('redis:ready')})redis.on('connect',()=>{// connectedconsole.log('redis:connected')})redis.on('reconnecting',()=>{// https://github.com/redis/ioredis?tab=readme-ov-file#auto-reconnect//// > By default, all pending commands will be flushed with an error// every 20 retry attempts.// That makes sure commands won't wait forever when the connection is down.// You can change this behavior by setting maxRetriesPerRequest:console.log('redis:reconnecting')})redis.on('error',err=>{// Will emit 20 times before giving up,// then have to manually reconnectconsole.log('redis:error',err)})redis.on('end',()=>{// Wont attempt reconnectconsole.log('redis:end')})
The text was updated successfully, but these errors were encountered:
We use it as a pub/sub mechanism so it needs to stay up.
To be fair, I don't ever recall us having any issues on prod. with Redis going down but I wonder if there's a "standard" way of handling those conditions.
On the one hand I'm thinking of attempting manual reconnects, on the other hand I'm tempted to just crash the whole process on end. The default reconn settings should be more than enough I suppose.
How "highly available" is the Redis server? Does it make an effort to avoid crashing? If that's the case, then there's 0 need to go overboard with attempting manual reconnections. If it's gone, it's gone, my service is down and someone needs to tend to it.
Hi people,
What's the recommended strategy for error handling?
So my understanding is that there's no need for me to do anything.
The default reconnection strategy of Redis is enough.
My question would be, do I need to throw in some handler? Do I want to fail-fast and crash the server process on
end
? Not entirely sure. Any advice welcome.Here's the whole of my conn. code. Just wanna make sure I set this up as robustly as possible.
The text was updated successfully, but these errors were encountered: