From 7067453416bbb4bbe0d936e727f9c74e97554c6a Mon Sep 17 00:00:00 2001 From: Ondrej Nosek Date: Aug 23 2023 06:22:29 +0000 Subject: Lookaside cache operations retries Both upload and download network operations might fail and in this case, a retry mechanism was implemented. In case of failure, there is a delay and another attempt(s). Delays are increasing with every attempt. A new key 'lookaside_attempts' in the configuration is there to parameterize such behavior. It expresses a maximum number of attempts to try the operation. Without this key, fedpkg will work the same as before = single attempt. Values 'lookaside_attempts = 1' or 'lookaside_attempts = 0' effectively disable retries too. The second new key 'lookaside_delay' is the initial delay (in seconds) between attempts that is doubled with each iteration. JIRA: RHELCMP-11210 Signed-off-by: Ondrej Nosek --- diff --git a/conf/etc/rpkg/fedpkg-stage.conf b/conf/etc/rpkg/fedpkg-stage.conf index eeae285..2a74b93 100644 --- a/conf/etc/rpkg/fedpkg-stage.conf +++ b/conf/etc/rpkg/fedpkg-stage.conf @@ -50,6 +50,8 @@ git_excludes = results_*/ clog results_dir=root +lookaside_attempts = 3 +lookaside_delay = 15 [fedpkg-stage.bodhi] # Refer to fedpkg.conf diff --git a/conf/etc/rpkg/fedpkg.conf b/conf/etc/rpkg/fedpkg.conf index f975f71..6365e80 100644 --- a/conf/etc/rpkg/fedpkg.conf +++ b/conf/etc/rpkg/fedpkg.conf @@ -50,6 +50,8 @@ git_excludes = results_*/ clog results_dir=root +lookaside_attempts = 3 +lookaside_delay = 15 [fedpkg.bodhi] # This is for the bodhi-client 2.x, that do not require an option to switch to diff --git a/fedpkg/__init__.py b/fedpkg/__init__.py index 15bf8eb..e307c3d 100644 --- a/fedpkg/__init__.py +++ b/fedpkg/__init__.py @@ -66,7 +66,8 @@ class Commands(pyrpkg.Commands): We override this because we need a different download path. """ return FedoraLookasideCache( - self.lookasidehash, self.lookaside, self.lookaside_cgi) + self.lookasidehash, self.lookaside, self.lookaside_cgi, + attempts=self.lookaside_attempts, delay=self.lookaside_delay) # Overloaded property loaders def load_rpmdefines(self): diff --git a/fedpkg/lookaside.py b/fedpkg/lookaside.py index 12ccd7b..01f79fd 100644 --- a/fedpkg/lookaside.py +++ b/fedpkg/lookaside.py @@ -18,9 +18,9 @@ from pyrpkg.lookaside import CGILookasideCache class FedoraLookasideCache(CGILookasideCache): - def __init__(self, hashtype, download_url, upload_url): + def __init__(self, hashtype, download_url, upload_url, attempts=None, delay=None): super(FedoraLookasideCache, self).__init__( - hashtype, download_url, upload_url) + hashtype, download_url, upload_url, attempts=attempts, delay=delay) self.download_path = ( '%(name)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s')