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

Limiter v4 Checklist #92

Open
novln opened this issue Apr 7, 2020 · 1 comment
Open

Limiter v4 Checklist #92

novln opened this issue Apr 7, 2020 · 1 comment

Comments

@novln
Copy link
Contributor

novln commented Apr 7, 2020

This is a checklist of refactoring, enhancements and/or features that I would like to take in the next major version of limiter:

  • Remove panic in DefaultErrorHandler: people may not have a recover middleware, and I would prefer that they overwrite the default behavior than relying on potential capture.
  • Reset precision: It seems some people use this library as a client-side limiter. The current reset mechanism is not great for burst because you could miss some tick if your rate period is in second. This is caused by an imprecise conversion from a TTL to a Unix timestamp.
  • Change rate limit dynamically: Few peoples have asked how we can change/update the rate limit "on the fly". I think it's a great feature.
  • Enable "client" mode: This limiter was designed for a server with HTTP. It's a shame that we can't use it properly as a "client" flavor.
  • Refactor GetContextFromState: We don't need time.Time for expiration and now is unused.
@novln novln added the objective label Apr 7, 2020
@alter123
Copy link

  • Change rate limit dynamically

To extend this further, I would suggest having configurable limits based on endpoint level can also be provided, for e.g., if I've 10 endpoints, and I want to limit only 3 endpoints and all of them can have different limits.
According to current implementations I possibly have to create a sub router or tweak the middleware implementation accordingly.

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

No branches or pull requests

2 participants