pgjones / quart-rate-limiter

Quart-Rate-Limiter is an extension for Quart to allow for rate limits to be defined and enforced on a per route basis.
MIT License
22 stars 6 forks source link

default_limits ignores key_function #9

Closed Quintenvw closed 2 months ago

Quintenvw commented 8 months ago

When using default_limits, it appears that the key_function is not being respected. This leads to unexpected behavior, as the rate limiting does not differentiate users based on the custom logic defined in the key_function.

Steps to Reproduce:

  1. Set up quart-rate-limiter with a relatively low rate limit in default_limits.
  2. Define a key_function to differentiate users.
  3. Observe that the rate limiting is applied universally, ignoring the distinctions made by key_function.

Suggested Solutions:

  1. If this behavior is not intended, which I assume it isn't, a small adjustment might be required to ensure default_limits respects the key_function.
  2. If the current behavior is by design, please update the README to clarify that default_limits doesn't respect key_function.

Thank you for your efforts in developing and maintaining quart-rate-limiter!

Best regards, Quintenvw

pgjones commented 4 months ago

I can't reproduce this, and I would expect the test_rate_limit_unique_keys test to fail if this was the case. Could you provide a snippet that reproduces?