Note that debouncing requires rates

This commit is contained in:
Aarni Koskela 2019-09-26 18:47:42 +03:00
parent 81c150b5e8
commit ed1c53ed23
2 changed files with 5 additions and 0 deletions

View File

@ -222,6 +222,8 @@ Using `get_debounce_interval()`, one can e.g. ensure superusers can always invok
return 0
return 5
Note that due to the current implementation, debouncing _requires_ a throttling rate to be set as well.
[cite]: https://developer.twitter.com/en/docs/basics/rate-limiting
[permissions]: permissions.md
[identifying-clients]: http://oxpedia.org/wiki/index.php?title=AppSuite:Grizzly#Multiple_Proxies_in_front_of_the_cluster

View File

@ -67,6 +67,9 @@ class SimpleRateThrottle(BaseThrottle):
debounce_interval = None
def __init__(self):
# TODO: this should probably be deferred to `allow_request`,
# to simplify `ScopedRateThrottle` as well as to allow debouncing
# without rate limiting.
if not getattr(self, 'rate', None):
self.rate = self.get_rate()
self.num_requests, self.duration = self.parse_rate(self.rate)