[calm - Cygwin server-side packaging maintenance script] branch master, updated. 20230209-118-g56594c6
Jon Turney via Cygwin-apps-cvs <[email protected]> Sun, 14 Jul 2024 19:42:47 +0000 (GMT)
| Newsgroups | gmane.os.cygwin.cvs.apps |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=56594c6724144daa82db16f2135f5549658b9ce2 commit 56594c6724144daa82db16f2135f5549658b9ce2 Author: Jon Turney <[email protected]> Date: Thu Jul 11 18:40:30 2024 +0100 Also rate-limit invidual repology API calls Also rate-limit invidual repology API calls, so we do not exceed repology's rate-limit instantaneously, as well as on average... Diff: --- calm/repology.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/calm/repology.py b/calm/repology.py index 487daca..9933bd4 100644 --- a/calm/repology.py +++ b/calm/repology.py @@ -138,6 +138,9 @@ def repology_fetch_versions(): else: last_pn = pn + # rate-limit individual API calls to once per second + time.sleep(1) + return upstream_versions @@ -145,7 +148,7 @@ 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: