mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-23 06:50:42 +03:00
Merge pull request #1440 from un33k/master
handle zero and negative available_requests
This commit is contained in:
commit
1a75e7b02b
|
@ -136,6 +136,8 @@ class SimpleRateThrottle(BaseThrottle):
|
|||
remaining_duration = self.duration
|
||||
|
||||
available_requests = self.num_requests - len(self.history) + 1
|
||||
if available_requests <= 0:
|
||||
return None
|
||||
|
||||
return remaining_duration / float(available_requests)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user