express-limiter icon indicating copy to clipboard operation
express-limiter copied to clipboard

Adds conditional to hanlde if redis becomes unavailable

Open michaelerobertsjr opened this issue 10 years ago • 6 comments

Nice package!!

However using this in production (even with a highly available Redis cluster), means that the developer needs to handle if Redis becomes unavailable.

This is highly unlikely, but we would not want our rate limiter to kill our route if Redis has any issue(s).

It's pretty hard to swap out middleware in a running express app when it is setup like this:

app.post('/api/endpoint', limiter(limitOptions),
  function (req, res) { ... }
);

I this was the simplest workaround I could think of. I will write some tests if you would like but, this patch is pretty easy to manually test...

michaelerobertsjr avatar Dec 08 '15 19:12 michaelerobertsjr

Hi @michaelerobertsjr thanks for your contribution! This is a good and viable patch. Would you mind sticking to the existing style of the code. run make lint and be sure to remove the double quotes and add a whitespace after keywords like function and if. Also, please remove the version bump. I'll take care of that myself. When finished push it back and I'll merge it.

ded avatar Dec 09 '15 22:12 ded

Any update on merging this change in? Its definitely a feature that I need. Thanks.

jpennal avatar Mar 23 '16 22:03 jpennal

@ded Can you have a look now? Removed the double quotes, added white space, and removed the version bump. Thx.

michaelerobertsjr avatar Mar 24 '16 18:03 michaelerobertsjr

Any word on this getting merged? This is something I also need. @ded

aaron-straker avatar May 09 '16 17:05 aaron-straker

any follow up ? @ded

vincentkwok avatar Sep 27 '17 03:09 vincentkwok

@ded bump

michaelerobertsjr avatar Oct 30 '17 18:10 michaelerobertsjr