From f2df3da169898ae1afa80724113649bda75ab28d Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Thu, 15 Aug 2024 08:10:23 +0100 Subject: [PATCH] Improve retry logic (#14) --- codecov-status.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/codecov-status.py b/codecov-status.py index 649c7f1..dc814b5 100755 --- a/codecov-status.py +++ b/codecov-status.py @@ -53,7 +53,9 @@ if data["head_totals"] is not None: head_cov = data["head_totals"]["coverage"] delta_coverage = head_cov - base_cov - if updatestamp > start_time: + # It can happen for updatestamp to be updated but head_totals to become + # None for some time, so we keep retrying until we have something. + if updatestamp > start_time and head_cov: break retries += 1 sleep = DELAY * (retries + 1)