Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit 94db1f9

Browse files
JerrySentrymichelletran-sentry
authored andcommitted
Bundle Analysis: fix processor retry (#1081)
1 parent 8170d78 commit 94db1f9

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

tasks/bundle_analysis_processor.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
class BundleAnalysisProcessorTask(
3131
BaseCodecovTask, name=bundle_analysis_processor_task_name
3232
):
33+
max_retries = 5
34+
3335
def run_impl(
3436
self,
3537
db_session,
@@ -75,7 +77,7 @@ def run_impl(
7577
previous_result,
7678
)
7779
except LockRetry as retry:
78-
self.retry(max_retries=5, countdown=retry.countdown)
80+
self.retry(countdown=retry.countdown)
7981

8082
def process_impl_within_lock(
8183
self,
@@ -139,9 +141,22 @@ def process_impl_within_lock(
139141
result: ProcessingResult = report_service.process_upload(
140142
commit, upload, compare_sha
141143
)
142-
if result.error and result.error.is_retryable and self.request.retries == 0:
143-
# retryable error and no retry has already be scheduled
144-
self.retry(max_retries=5, countdown=20)
144+
if (
145+
result.error
146+
and result.error.is_retryable
147+
and self.request.retries < self.max_retries
148+
):
149+
log.warn(
150+
"Attempting to retry bundle analysis upload",
151+
extra=dict(
152+
repoid=repoid,
153+
commit=commitid,
154+
commit_yaml=commit_yaml,
155+
params=params,
156+
result=result.as_dict(),
157+
),
158+
)
159+
self.retry(countdown=30 * (2**self.request.retries))
145160
result.update_upload(carriedforward=carriedforward)
146161

147162
processing_results.append(result.as_dict())

tasks/tests/unit/test_bundle_analysis_processor_task.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def test_bundle_analysis_processor_task_error(
176176

177177
assert commit.state == "error"
178178
assert upload.state == "error"
179-
retry.assert_called_once_with(countdown=20, max_retries=5)
179+
retry.assert_called_once_with(countdown=30)
180180

181181

182182
def test_bundle_analysis_processor_task_general_error(
@@ -362,7 +362,7 @@ def test_bundle_analysis_processor_task_locked(
362362
assert result is None
363363

364364
assert upload.state == "started"
365-
retry.assert_called_once_with(countdown=ANY, max_retries=5)
365+
retry.assert_called_once_with(countdown=ANY)
366366

367367

368368
def test_bundle_analysis_process_upload_rate_limit_error(
@@ -431,7 +431,7 @@ def test_bundle_analysis_process_upload_rate_limit_error(
431431

432432
assert commit.state == "error"
433433
assert upload.state == "error"
434-
retry.assert_called_once_with(countdown=20, max_retries=5)
434+
retry.assert_called_once_with(countdown=30)
435435

436436

437437
def test_bundle_analysis_process_associate_no_parent_commit_id(

0 commit comments

Comments
 (0)