I’m using ioredis.
In order to prevent a huge buffer that can crash my app, I want to ignore requests when redis is down, and to catch those requests.
Is there any way to achieve that?
I’m using ioredis.
In order to prevent a huge buffer that can crash my app, I want to ignore requests when redis is down, and to catch those requests.
Is there any way to achieve that?
2
Answers
You may use circuit breaker design pattern.
Martin fowler’s blog post has a good explanation and a basic implementation about how to do it.
For other people finding this who want a bit more help. This intercepts commends to ioredis and just returns false if it’s not in a ready state.