Auto reconnect?
amit777 opened this issue · 6 comments
I noticed after some long period of time, some of my processeses that use redis cache manager get exceptions related to timeout. Is redis cache manager supposed to reconnect automatically? When I restart the process, everything reconnects fine. The problem starts with this error:
[Error: Redis connection to 127.0.0.1:6379 failed - connect ETIMEDOUT 127.0.0.1:6379]
Then subsequently all errors say this in my logs:
[Error: Redis connection error]
@amit777 you are right, my PR ( #2 ) is causing this behavior, it was a quick solution to the unhandled exception but it's not a good solution as it will not reconnect.
sol-redis-pool only emits errors, so to listen to "connected" events we would have to listen to each client in the pool i think. I don't have much experience with redis clients but if i have time soon, i will try to implement a better solution.
Maybe as a workaround it could emit an event that we can listen for. I'll take a look more later at your PR to see if any other ideas.
also, maybe this is an example of a possible solution type: redis/node-redis@e8d9858
Thanks guys !
The v0.2.0 is available on npm : https://www.npmjs.com/package/cache-manager-redis
This release should fix this issue.