https://github.com/python/cpython/commit/3233cff84e6248e11c1581eaf509bc298ea04d87
commit: 3233cff84e6248e11c1581eaf509bc298ea04d87
branch: 3.14
author: Emma Smith <[email protected]>
committer: hugovk <[email protected]>
date: 2025-06-17T14:50:15+03:00
summary:
[3.14] gh-134262: increase retries in `Tools/build/generate_sbom.py` … (#135596)
files:
M Tools/build/generate_sbom.py
diff --git a/Tools/build/generate_sbom.py b/Tools/build/generate_sbom.py
index 89f8f83999c47e..df52f8de762a01 100644
--- a/Tools/build/generate_sbom.py
+++ b/Tools/build/generate_sbom.py
@@ -4,6 +4,7 @@
import hashlib
import json
import os
+import random
import re
import subprocess
import sys
@@ -164,16 +165,18 @@ def get_externals() -> list[str]:
def download_with_retries(download_location: str,
- max_retries: int = 5,
- base_delay: float = 2.0) -> typing.Any:
+ max_retries: int = 7,
+ base_delay: float = 2.25,
+ max_jitter: float = 1.0) -> typing.Any:
"""Download a file with exponential backoff retry."""
for attempt in range(max_retries + 1):
try:
resp = urllib.request.urlopen(download_location)
except urllib.error.URLError as ex:
if attempt == max_retries:
- raise ex
- time.sleep(base_delay**attempt)
+ msg = f"Download from {download_location} failed."
+ raise OSError(msg) from ex
+ time.sleep(base_delay**attempt + random.uniform(0, max_jitter))
else:
return resp
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]