rack-attack icon indicating copy to clipboard operation
rack-attack copied to clipboard

Allow customization of weight per request for rate limiting

Open jiang925 opened this issue 5 years ago • 1 comments

Use case: We have an API to allow the client to fetch data by a list of ids. The API allows up to a few thousand ids. In order to better throttling experience, we want to throttle based on the number of ids being fetch. Add a weight option to specify the rate to deduct the limit.

Added tests and tests pass.

jiang925 avatar Nov 16 '20 21:11 jiang925

Hi @jiang925 ,

Thank you very much for the contribution!

On the one hand this seems like an interesting feature, while on the other I have concerns about whether this may add unnecessary complexity to the library and the docs/API if this is not used a lot by users.

I want to give it some more thought though. :thinking:

Thanks again!

grzuy avatar Jun 15 '21 16:06 grzuy