From 423bd245e877d3a60bf6c42d3ddd3162c41dad38 Mon Sep 17 00:00:00 2001 From: Aaron Meurer Date: Fri, 1 Feb 2019 14:33:22 -0700 Subject: [PATCH 1/2] Better error message for giving up on retries --- doctr/travis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doctr/travis.py b/doctr/travis.py index 0f15eca5..b79865ff 100644 --- a/doctr/travis.py +++ b/doctr/travis.py @@ -557,7 +557,7 @@ def push_docs(deploy_branch='gh-pages', retries=5): time.sleep(1) else: return - sys.exit("Giving up...") + sys.exit("Giving up pushing after {retries} tries :(".format(retries=retries)) def last_commit_by_doctr(): """Check whether the author of `HEAD` is `doctr` to avoid starting an From d1800dcb1b6cbc208475e17cc64e5ce2955b95bb Mon Sep 17 00:00:00 2001 From: Aaron Meurer Date: Fri, 1 Feb 2019 14:34:39 -0700 Subject: [PATCH 2/2] Do an exponential backoff on retrys --- doctr/travis.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doctr/travis.py b/doctr/travis.py index b79865ff..9181a923 100644 --- a/doctr/travis.py +++ b/doctr/travis.py @@ -544,7 +544,7 @@ def push_docs(deploy_branch='gh-pages', retries=5): """ code = 1 - while code and retries: + for i in range(retries): print("Pulling") code = run(['git', 'pull', '-s', 'recursive', '-X', 'ours', 'doctr_remote', deploy_branch], exit=False) @@ -554,7 +554,7 @@ def push_docs(deploy_branch='gh-pages', retries=5): if code: retries -= 1 print("Push failed, retrying") - time.sleep(1) + time.sleep(2**i) else: return sys.exit("Giving up pushing after {retries} tries :(".format(retries=retries))