mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 01:26:53 +03:00
pick deque instead of list (#7849)
Co-authored-by: Jack Zhang <jack.zhang@aspiraconnect.com>
This commit is contained in:
parent
71e6c30034
commit
ebcb8d5310
|
@ -2,6 +2,7 @@
|
|||
Provides various throttling policies.
|
||||
"""
|
||||
import time
|
||||
from collections import deque
|
||||
|
||||
from django.core.cache import cache as default_cache
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
|
@ -120,7 +121,7 @@ class SimpleRateThrottle(BaseThrottle):
|
|||
if self.key is None:
|
||||
return True
|
||||
|
||||
self.history = self.cache.get(self.key, [])
|
||||
self.history = self.cache.get(self.key, deque())
|
||||
self.now = self.timer()
|
||||
|
||||
# Drop any requests from the history which have now passed the
|
||||
|
|
Loading…
Reference in New Issue
Block a user