Skip to content

Commit

Permalink
Also rate-limit invidual repology API calls
Browse files Browse the repository at this point in the history
Also rate-limit invidual repology API calls, so we do not exceed
repology's rate-limit instantaneously, as well as on average...
  • Loading branch information
jon-turney committed Jul 11, 2024
1 parent 8653d5f commit 56594c6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion calm/repology.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,17 @@ def repology_fetch_versions():
else:
last_pn = pn

# rate-limit individual API calls to once per second
time.sleep(1)

return upstream_versions


def annotate_packages(args, packages):
global last_check
global last_data

# rate limit to daily
# rate-limit fetching data to daily
if (time.time() - last_check) < (24 * 60 * 60):
logging.info("not consulting %s due to ratelimit" % (REPOLOGY_API_URL))
else:
Expand Down

0 comments on commit 56594c6

Please sign in to comment.