Skip to content

Commit 6b211b8

Browse files
authored
fix: Add retry logic to final GitHub status update
2 parents 58cd57b + e7f666b commit 6b211b8

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

mod_ci/controllers.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1933,8 +1933,16 @@ def progress_type_request(log, test, test_id, request) -> bool:
19331933
else:
19341934
message = progress.message
19351935

1936-
gh_commit = repository.get_commit(test.commit)
1937-
update_status_on_github(gh_commit, state, message, context, target_url=target_url)
1936+
# Use retry logic for final GitHub status update to prevent stuck "pending" states
1937+
# This is critical - if this fails, the PR will show "Tests queued" forever
1938+
try:
1939+
def update_final_status():
1940+
gh_commit = repository.get_commit(test.commit)
1941+
update_status_on_github(gh_commit, state, message, context, target_url=target_url)
1942+
1943+
retry_with_backoff(update_final_status, max_retries=3, initial_backoff=2.0)
1944+
except Exception as e:
1945+
log.error(f"Test {test_id}: Failed to update final GitHub status after retries: {e}")
19381946

19391947
if status in [TestStatus.completed, TestStatus.canceled]:
19401948
# Delete the current instance

0 commit comments

Comments
 (0)