handle negative time value and prevent a divide by zero

This commit is contained in:
Val Neekman 2014-02-27 12:27:54 -08:00
parent 6e92e415aa
commit 818b4bf8b3

View File

@ -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)