fix incorrect rate limit handling for mastodon

This commit is contained in:
nanos 2023-08-03 15:21:59 +01:00
parent 3294a44f76
commit c90a7e42ab

View file

@ -738,7 +738,7 @@ def get_mastodon_urls(webserver, toot_id, toot_url):
reset = datetime.strptime(resp.headers['x-ratelimit-reset'], '%Y-%m-%dT%H:%M:%S.%fZ') reset = datetime.strptime(resp.headers['x-ratelimit-reset'], '%Y-%m-%dT%H:%M:%S.%fZ')
log(f"Rate Limit hit when getting context for {toot_url}. Waiting to retry at {resp.headers['x-ratelimit-reset']}") log(f"Rate Limit hit when getting context for {toot_url}. Waiting to retry at {resp.headers['x-ratelimit-reset']}")
time.sleep((reset - datetime.now()).total_seconds() + 1) time.sleep((reset - datetime.now()).total_seconds() + 1)
return get_toot_context(server, toot_id, toot_url, seen_hosts) return get_mastodon_urls(webserver, toot_id, toot_url)
log( log(
f"Error getting context for toot {toot_url}. Status code: {resp.status_code}" f"Error getting context for toot {toot_url}. Status code: {resp.status_code}"