mrkschan / cuttle

:octopus: - Rate limit HTTP API calls per access token
MIT License
48 stars 14 forks source link

Limit to under 1 request per second? #18

Open nathanpalmer opened 7 years ago

nathanpalmer commented 7 years ago

We're looking for a solution to limit requests to an external API to slow down our requests (from multiple backend services) to conform with their rate limits. They have set a 30 request per minute limit which is going to be roughly ½ requests per second.

This doesn't seem to fit in with cuttle's configuration as anything under 0 is throwing an exception. I would essentially need to set a rate: .5 in the configuration I believe.

mrkschan commented 7 years ago

If your API service support busting up to 30 requests per 60s, it make senses to add a new request-per-minutes rate limit control :) @nathanpalmer

ivarec commented 6 years ago

But the "rpm" solution means that I can burst 30 requests in 1 second, and then spend the other 59 seconds of the current minute waiting.

What if I really want to limit my requests to one request per 2 seconds? The decimal solution seems necessary as well.

fship7 commented 5 years ago

I made a pull request for a fork that addresses this issue:

https://github.com/mrkschan/cuttle/pull/21