diff options
| author | Tom Christie | 2014-02-28 09:18:03 +0000 |
|---|---|---|
| committer | Tom Christie | 2014-02-28 09:18:03 +0000 |
| commit | 1a75e7b02b5c838cb7b4b3124c4f6b5873c00c91 (patch) | |
| tree | 5de421d6b2bfcfaa3744a72f1b492cf7e4881472 /rest_framework | |
| parent | 6e92e415aa7dd6871ef7d6500a85cacebde8dca2 (diff) | |
| parent | 818b4bf8b354d43360e3fd9d0b10440636a25212 (diff) | |
| download | django-rest-framework-1a75e7b02b5c838cb7b4b3124c4f6b5873c00c91.tar.bz2 | |
Merge pull request #1440 from un33k/master
handle zero and negative available_requests
Diffstat (limited to 'rest_framework')
| -rw-r--r-- | rest_framework/throttling.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/rest_framework/throttling.py b/rest_framework/throttling.py index a946d837..efa9fb94 100644 --- a/rest_framework/throttling.py +++ b/rest_framework/throttling.py @@ -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) |
