Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

Commit

Permalink
Added sleep between upload retries. (#295)
Browse files Browse the repository at this point in the history
* Added sleep 2s between upload retries.

* Set default retries to 5 same as bash uploader.

* Log retry attempts.
  • Loading branch information
nmoinvaz committed Sep 14, 2020
1 parent 0c56f29 commit 2574d1b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions codecov/__init__.py
Expand Up @@ -290,11 +290,14 @@ def generate_toc(root):
return str(res).strip() or ""


def retry_upload(url, request_method, retries=3, break_codes=(200,), **kwargs):
for _ in range(retries):
def retry_upload(url, request_method, retries=5, break_codes=(200,), **kwargs):
wait_seconds = 2
for i in range(retries):
res = request_method(url, **kwargs)
if res.status_code in break_codes:
return res
write(" Retrying {0}/{1} in {2}s..".format(i + 1, retries, wait_seconds))
sleep(wait_seconds)
return res


Expand Down Expand Up @@ -412,7 +415,7 @@ def main(*argv, **kwargs):
advanced.add_argument("--tag", default=None, help="Git tag")
advanced.add_argument(
"--tries",
default=3,
default=5,
type=int,
help="Specify the total number of attempts to make when uploading coverage report",
)
Expand Down

0 comments on commit 2574d1b

Please sign in to comment.