Skip to content

Commit ebcb8d5

Browse files
zhan9sanJack Zhang
and
Jack Zhang
authored
pick deque instead of list (encode#7849)
Co-authored-by: Jack Zhang <jack.zhang@aspiraconnect.com>
1 parent 71e6c30 commit ebcb8d5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

rest_framework/throttling.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Provides various throttling policies.
33
"""
44
import time
5+
from collections import deque
56

67
from django.core.cache import cache as default_cache
78
from django.core.exceptions import ImproperlyConfigured
@@ -120,7 +121,7 @@ def allow_request(self, request, view):
120121
if self.key is None:
121122
return True
122123

123-
self.history = self.cache.get(self.key, [])
124+
self.history = self.cache.get(self.key, deque())
124125
self.now = self.timer()
125126

126127
# Drop any requests from the history which have now passed the

0 commit comments

Comments
 (0)