mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-27 08:29:59 +03:00
add explicit timer method implementation
This commit is contained in:
parent
7cd5ae7275
commit
132cd9e843
|
@ -60,7 +60,6 @@ class SimpleRateThrottle(BaseThrottle):
|
|||
Previous request information used for throttling is stored in the cache.
|
||||
"""
|
||||
cache = default_cache
|
||||
timer = staticmethod(time.time)
|
||||
cache_format = 'throttle_%(scope)s_%(ident)s'
|
||||
scope = None
|
||||
THROTTLE_RATES = api_settings.DEFAULT_THROTTLE_RATES
|
||||
|
@ -131,6 +130,10 @@ class SimpleRateThrottle(BaseThrottle):
|
|||
return self.throttle_failure()
|
||||
return self.throttle_success()
|
||||
|
||||
def timer(self):
|
||||
"""Time in seconds since the epoch."""
|
||||
return time.time()
|
||||
|
||||
def throttle_success(self):
|
||||
"""
|
||||
Inserts the current request's timestamp along with the key
|
||||
|
|
Loading…
Reference in New Issue
Block a user