-
Notifications
You must be signed in to change notification settings - Fork 185
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
Intermittent CI fail with ratelimit #64
Comments
Ratelimits are calculated on staggered, fixed windows, i.e., for a given set of group/path/methods/key-value/period, ratelimit will calculate some value that will be the same every time it's calculated for So, imagine the limit is
The reason for this is that if you reset the period every time (what ratelimit used to do) then you can end up blocking even good actors basically forever (e.g. they try every 59 seconds, continually pushing the limit out and never being allowed). So what's probably happening is that every once in a while, you cross the boundary during that loop. The odds are bad—and your flakiness rate is low—but it's entirely possible. You could probably simplify this by mocking |
Thanks a lot, makes complete sense, this had occurred to me but I assumed the limit was reset every time. Thanks for your help. |
For anyone else having trouble with ratelimt and CI, my solution is:
|
We're using ratelimit for our login page:
(in settings
LOGIN_LIMIT = '4/m'
)And test the rate limit is working on tests:
This always works locally and works about 95% of the time on CI but just occationally fails with
I'm aware there's a good chance this could be a weird error unique to our system but I thought it was worth asking whether there's any pointer as to what's causing ratelimit not to kick in?
The text was updated successfully, but these errors were encountered: