ejfinneran / ratelimit

A Redis-backed rate limiter written in Ruby
MIT License
257 stars 55 forks source link

Alternative limiter #38

Open ncr opened 3 years ago

ncr commented 3 years ago

I think the limiter uses expire incorrectly on the Redis hashes. In my observation, the limiter works for some time but when it wraps around the bucket_span, it blocks until the expire takes place on the whole limiter hash.

Here's a similar implementation that operates on invidual keys: https://gist.github.com/ncr/c2b1b62a8d2b636daca1dff12b457a31

kpheasey commented 3 years ago

I like your simple implementation. It's clean, transparent, and can be easily modified. Since this project seems dead, I think I'll implement the feature by just including your class.

ncr commented 3 years ago

Thanks :) Feel free to use my implementation!

phillipp commented 7 months ago

@ncr @kpheasey Is this fixed with #46 ?