tweak ip-api cooldown

This commit is contained in:
Connor Olding 2021-08-13 02:35:05 -07:00
parent f1a5cbe69f
commit 477f983145

View File

@ -72,7 +72,6 @@ class IpInfoByIpApi(IpInfoBase):
if x_remaining == 0:
self.cooldown = time() + x_cooldown
self.cooldown += 1.0 # still too frequent according to them
return None # no error
@ -85,7 +84,8 @@ class IpInfoByIpApi(IpInfoBase):
# for the duration of X-Ttl in seconds.
while time() < self.cooldown:
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)
async def http_lookup(self, ip):