tweak ip-api cooldown
This commit is contained in:
parent
f1a5cbe69f
commit
477f983145
1 changed files with 2 additions and 2 deletions
|
@ -72,7 +72,6 @@ class IpInfoByIpApi(IpInfoBase):
|
||||||
|
|
||||||
if x_remaining == 0:
|
if x_remaining == 0:
|
||||||
self.cooldown = time() + x_cooldown
|
self.cooldown = time() + x_cooldown
|
||||||
self.cooldown += 1.0 # still too frequent according to them
|
|
||||||
|
|
||||||
return None # no error
|
return None # no error
|
||||||
|
|
||||||
|
@ -85,7 +84,8 @@ class IpInfoByIpApi(IpInfoBase):
|
||||||
# for the duration of X-Ttl in seconds.
|
# for the duration of X-Ttl in seconds.
|
||||||
while time() < self.cooldown:
|
while time() < self.cooldown:
|
||||||
wait = self.cooldown - time()
|
wait = self.cooldown - time()
|
||||||
wait = max(wait, 0.1) # wait at least a little bit
|
wait = max(0, wait) # must not be negative!
|
||||||
|
wait += 0.1 # still too frequent according to them
|
||||||
await sleep(wait)
|
await sleep(wait)
|
||||||
|
|
||||||
async def http_lookup(self, ip):
|
async def http_lookup(self, ip):
|
||||||
|
|
Loading…
Add table
Reference in a new issue