mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-27 08:29:59 +03:00
Intialize self.history if only the key is not in cache
This commit is contained in:
parent
fe183fd3d2
commit
d80b317b6a
|
@ -121,7 +121,10 @@ class SimpleRateThrottle(BaseThrottle):
|
||||||
if self.key is None:
|
if self.key is None:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
self.history = self.cache.get(self.key, deque())
|
self.history = self.cache.get(self.key)
|
||||||
|
if self.history is None:
|
||||||
|
self.history = deque()
|
||||||
|
|
||||||
self.now = self.timer()
|
self.now = self.timer()
|
||||||
|
|
||||||
# Drop any requests from the history which have now passed the
|
# Drop any requests from the history which have now passed the
|
||||||
|
|
Loading…
Reference in New Issue
Block a user