mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 23:51:32 +00:00
Fix RateLimiter semantics
This commit is contained in:
parent
3c3012ffe8
commit
8a0928beca
@ -51,10 +51,10 @@ class RateLimiter:
|
|||||||
def _limit_rate(self):
|
def _limit_rate(self):
|
||||||
seconds_since_last_call = time() - self.last_call
|
seconds_since_last_call = time() - self.last_call
|
||||||
seconds_to_next_call = self.min_interval - seconds_since_last_call
|
seconds_to_next_call = self.min_interval - seconds_since_last_call
|
||||||
self.last_call = time()
|
|
||||||
|
|
||||||
if seconds_to_next_call > 0:
|
if seconds_to_next_call > 0:
|
||||||
return seconds_to_next_call
|
return seconds_to_next_call
|
||||||
|
self.last_call = time()
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user