You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe that when application rate limits are specified and a per endpoint rate limit is specified, then the application rate limits are applied twice - once in the before_request() hook and second in the decorated route, i.e. one request is counted as if it was 2.
Example:
app=Flask(__name__)
limiter=Limiter(app, application_limits=["600 per minute"])
@app.route("/")@limiter.limit("300 per minute")defindex():
return"test"@app.route("/2")defindex2():
return"test2"
Every request to / will be counted as two requests towards the application limit of 600 per minute and as one request towards the per route limit of 300 per minute.
With /2, everything works as expected in that one request counts as one request towards the application limit of 600 per minute.
Looking at the code, I think this is handled for default_limits but not for application_limits. I might be able to have a go at a patch but not sure when.
The text was updated successfully, but these errors were encountered:
I believe that when application rate limits are specified and a per endpoint rate limit is specified, then the application rate limits are applied twice - once in the before_request() hook and second in the decorated route, i.e. one request is counted as if it was 2.
Example:
Every request to / will be counted as two requests towards the application limit of 600 per minute and as one request towards the per route limit of 300 per minute.
With /2, everything works as expected in that one request counts as one request towards the application limit of 600 per minute.
Looking at the code, I think this is handled for default_limits but not for application_limits. I might be able to have a go at a patch but not sure when.
The text was updated successfully, but these errors were encountered: