Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return which limit rule was reached #4

Open
ofirnk opened this issue Jul 30, 2017 · 3 comments
Open

Return which limit rule was reached #4

ofirnk opened this issue Jul 30, 2017 · 3 comments

Comments

@ofirnk
Copy link
Contributor

ofirnk commented Jul 30, 2017

We love your published library and very likely to use it.

One idea to improve is to return not just a simple boolean but a rich object of type {isOverLimit:boolean, limitingRule:RequestLimitRule} or similar.
Exact type is not critical, it's just the idea of letting the user (be it internal or external) - which limit was reached.

So currently - the user would just get false when she's limited.
After - she'd know what exactly blocked her access.

WDYT?

p.s
I know it's a major refactor to internal logic + interface.. but it can be done in a non-breaking mode

@mokies
Copy link
Owner

mokies commented Jul 31, 2017

Yes it is a good idea and something I am considering as it maybe useful to return counts to upstream clients like so:

Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
X-RateLimit-Reset: 1372700873

This is something that Github's API has https://developer.github.com/v3/rate_limit/

@ofirnk
Copy link
Contributor Author

ofirnk commented Jul 31, 2017

Exactly what I was targeting!

@coi18n
Copy link

coi18n commented Nov 19, 2020

Craig, we are making extensive usage of your library to control/limit some protocols. Works like a charm so far (combined with Redis). Returning which limit rule was reached is definitively an important tuning feature. Many thanks for your great job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants