From: Andrei Pavel Date: Thu, 2 Sep 2021 12:02:08 +0000 (+0300) Subject: [#2058] hammer.py: retry upload on 504 X-Git-Tag: Kea-2.0.0~164 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3f57f06c2e32578d8a6ffe536ce77bfc379ad97b;p=thirdparty%2Fkea.git [#2058] hammer.py: retry upload on 504 --- diff --git a/hammer.py b/hammer.py index bec3d2e0e3..d4bf2e172f 100755 --- 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):