From c8d74a560cb629fa1b3045bca10ccd9acc8d2760 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Fri, 13 Jun 2025 18:15:23 +0200 Subject: [PATCH] Nix build retry downloads --- nix/build-all.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/nix/build-all.py b/nix/build-all.py index 5455586a0e..39c2fa421e 100644 --- a/nix/build-all.py +++ b/nix/build-all.py @@ -69,6 +69,7 @@ import sysconfig import ssl ssl._create_default_https_context = ssl._create_unverified_context +import time from urllib.request import urlretrieve @@ -385,7 +386,14 @@ def build_dependency(name, mode, build_tool_args, download_url, download_name, d download_path = os.path.join(build_dir, download_name) if not os.path.exists(download_path): - urlretrieve(url, os.path.join(build_dir, download_path)) + for _ in range(3): + try: + urlretrieve(url, os.path.join(build_dir, download_path)) + break + except ConnectionError as e: + print(e, "... retrying...") + time.sleep(30.) + continue else: logger.info(f"Download '{download_path}' already exists, assuming it's an undamaged download and that it has been extracted if possible, skipping") elif download_tool == download_tool_git: