vutran1710 / PyrateLimiter

⚔️Python Rate-Limiter using Leaky-Bucket Algorithm Family
https://pyratelimiter.readthedocs.io
MIT License
349 stars 36 forks source link

Support sub second intervals #75

Closed judahrand closed 1 year ago

judahrand commented 2 years ago

I've run into an issue with this package where I'm unable to respect NGINX rate limits because they are automatically applied on a per millisecond basis: https://www.nginx.com/blog/rate-limiting-nginx/#Configuring-Basic-Rate-Limiting.

This means even if I set the limit 'correctly' per second PyrateLimiter won't respect the millisecond latency. Therefore, PyrateLimiter should support millisecond intervals.

judahrand commented 2 years ago

It looks like this does already work as you can pass a float to the interval parameter. However, the type hinting doesn't match.

petroslamb commented 9 months ago

Correct me if I am wrong, but the redis backend complained with a non integer interval on v2.10.0.

vutran1710 commented 9 months ago

Correct me if I am wrong, but the redis backend complained with a non integer interval on v2.10.0.

Yes