From 477f983145260db25b70bafb5777f0168376899d Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Fri, 13 Aug 2021 02:35:05 -0700 Subject: [PATCH] tweak ip-api cooldown --- respodns/ip_info.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/respodns/ip_info.py b/respodns/ip_info.py index 365a2a8..b22af89 100644 --- a/respodns/ip_info.py +++ b/respodns/ip_info.py @@ -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):