]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2058] hammer.py: retry upload on 504
authorAndrei Pavel <andrei@isc.org>
Thu, 2 Sep 2021 12:02:08 +0000 (15:02 +0300)
committerAndrei Pavel <andrei@isc.org>
Thu, 2 Sep 2021 12:02:12 +0000 (15:02 +0300)
hammer.py

index bec3d2e0e31804ffd49500cb248458c7c6c94aa1..d4bf2e172fe947a67917b296ad42e9b799c203ab 100755 (executable)
--- a/hammer.py
+++ b/hammer.py
@@ -2759,7 +2759,16 @@ def upload_to_repo(args, pkgs_dir):
         log.info("upload cmd: %s", upload_cmd)
         log.info("fp: %s", fp)
         cmd = upload_cmd % fp
-        execute(cmd)
+
+        attempts=4
+        while attempts > 0:
+            exitcode, output = execute(cmd, capture=True)
+            if exitcode != 0 and '504 Gateway Time-out' in output:
+                log.info('Trying again after 8 seconds...')
+                attempts -= 1
+                time.sleep(8)
+            else:
+                break
 
 
 def build_cmd(args):