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
Add period for rate limiter middleware #6055
Conversation
yay I deleted my branch while doing some cleanup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM :)
We're getting some user feedback that they would like to be able to specify a rate limit lower than 1 request per second. One possibility would have been to change the "average" field to a float (e.g. 6 requests / minute would have been average=0.1). However, that would break the configuration (among other things) as TOML will not decode a value that looks like an int (no decimal point specified) into a Go float64. Therefore, this PR (re-)introduces the notion of a period, that allows one to (optionally) specify the duration for which the given average applies. The default value for the period is 1 second, which means if no period is specified, the meaning of the average does not change compared with before this change (it is still in requests/s). Fixes traefik#5918
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What does this PR do?
We're getting some user feedback that they would like to be able to specify a rate limit lower than 1 request per second.
One possibility would have been to change the "average" field to a float (e.g. 6 requests / minute would have been average=0.1).
However, that would break the configuration (among other things) as TOML will not decode a value that looks like an int (no decimal point specified) into a Go float64.
Therefore, this PR (re-)introduces the notion of a period, that allows one to (optionally) specify the duration for which the given average applies.
The default value for the period is 1 second, which means if no period is specified, the meaning of the average does not change compared with before this change (it is still in requests/s).
Motivation
Fixes #5918
More