Commit 818b4bf8 by Val Neekman

handle negative time value and prevent a divide by zero

parent 6e92e415
...@@ -136,6 +136,8 @@ class SimpleRateThrottle(BaseThrottle): ...@@ -136,6 +136,8 @@ class SimpleRateThrottle(BaseThrottle):
remaining_duration = self.duration remaining_duration = self.duration
available_requests = self.num_requests - len(self.history) + 1 available_requests = self.num_requests - len(self.history) + 1
if available_requests <= 0:
return None
return remaining_duration / float(available_requests) return remaining_duration / float(available_requests)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment