From 17edb56b98b8966f6083f3014712fe14eca92cb9 Mon Sep 17 00:00:00 2001 From: zliu3 Date: Fri, 17 May 2024 11:46:30 -0700 Subject: [PATCH] retry on timeout Signed-off-by: zliu3 --- gordian/repo.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gordian/repo.py b/gordian/repo.py index 0c53a0b..1561d80 100644 --- a/gordian/repo.py +++ b/gordian/repo.py @@ -126,7 +126,7 @@ def _set_target_branch(self, target_branch, source_branch=None): self.branch_name = f"refs/heads/{datetime.datetime.now().strftime('%Y-%m-%d-%H%M%S.%f')}" self.source_branch = self.target_ref - @retry(GithubException, tries=3, delay=1, backoff=2) + @retry((GithubException, TimeoutError), tries=3, delay=1, backoff=2) def _get_repo_contents(self, path): try: logger.debug(f'Fetching repo contents {path}...') @@ -135,6 +135,8 @@ def _get_repo_contents(self, path): if e.status == 404: raise e logger.info(f'Error fetching repo contents: {e}') + except TimeoutError as e: + logger.info(f'Error fetching repo contents: {e}') @retry(GithubException, tries=3, delay=1, backoff=2) def _make_branch(self):