From cb2834bdf98a66870734e9b7c418ff46a785f2e1 Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Tue, 26 Nov 2024 09:47:25 -0500 Subject: [PATCH] hermetic: retry on failed network requests --- mock/py/mock-hermetic-repo.py | 4 ++++ releng/release-notes-next/hermetic-download-retry.bugfix.md | 1 + 2 files changed, 5 insertions(+) create mode 100644 releng/release-notes-next/hermetic-download-retry.bugfix.md diff --git a/mock/py/mock-hermetic-repo.py b/mock/py/mock-hermetic-repo.py index 9410e611a..12fc75a1f 100755 --- a/mock/py/mock-hermetic-repo.py +++ b/mock/py/mock-hermetic-repo.py @@ -15,14 +15,18 @@ import shutil import subprocess import sys + from urllib.parse import quote +import backoff import requests logging.basicConfig(level=logging.DEBUG) log = logging.getLogger(__name__) +@backoff.on_exception(backoff.expo, requests.exceptions.RequestException, + max_tries=5, max_time=300) def download_file(url, outputdir): """ Download a single file (pool worker) diff --git a/releng/release-notes-next/hermetic-download-retry.bugfix.md b/releng/release-notes-next/hermetic-download-retry.bugfix.md new file mode 100644 index 000000000..25fb4479b --- /dev/null +++ b/releng/release-notes-next/hermetic-download-retry.bugfix.md @@ -0,0 +1 @@ +The mock-hermetic-repo command now implements a retry mechanism for downloading files.