Improve rate limiting and tests, for #80
This commit is contained in:
parent
a1867cc8d4
commit
40ea12a22f
2 changed files with 17 additions and 2 deletions
|
@ -302,8 +302,10 @@ class _Network(object):
|
|||
DELAY_TIME = 0.2
|
||||
now = time.time()
|
||||
|
||||
if (now - self.last_call_time) < DELAY_TIME:
|
||||
time.sleep(now - self.last_call_time - DELAY_TIME)
|
||||
time_since_last = now - self.last_call_time
|
||||
|
||||
if time_since_last < DELAY_TIME:
|
||||
time.sleep(DELAY_TIME - time_since_last)
|
||||
|
||||
self.last_call_time = now
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue