mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-29 17:39:48 +03:00
Note that debouncing requires rates
This commit is contained in:
parent
81c150b5e8
commit
ed1c53ed23
|
@ -222,6 +222,8 @@ Using `get_debounce_interval()`, one can e.g. ensure superusers can always invok
|
||||||
return 0
|
return 0
|
||||||
return 5
|
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
|
[cite]: https://developer.twitter.com/en/docs/basics/rate-limiting
|
||||||
[permissions]: permissions.md
|
[permissions]: permissions.md
|
||||||
[identifying-clients]: http://oxpedia.org/wiki/index.php?title=AppSuite:Grizzly#Multiple_Proxies_in_front_of_the_cluster
|
[identifying-clients]: http://oxpedia.org/wiki/index.php?title=AppSuite:Grizzly#Multiple_Proxies_in_front_of_the_cluster
|
||||||
|
|
|
@ -67,6 +67,9 @@ class SimpleRateThrottle(BaseThrottle):
|
||||||
debounce_interval = None
|
debounce_interval = None
|
||||||
|
|
||||||
def __init__(self):
|
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):
|
if not getattr(self, 'rate', None):
|
||||||
self.rate = self.get_rate()
|
self.rate = self.get_rate()
|
||||||
self.num_requests, self.duration = self.parse_rate(self.rate)
|
self.num_requests, self.duration = self.parse_rate(self.rate)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user