Skip to content
This repository was archived by the owner on Mar 20, 2024. It is now read-only.

Commit 387c218

Browse files
author
bors-servo
authored
Auto merge of #134 - Eh2406:master, r=Manishearth
retry if 422 Update is not a fast forward As @kennytm suggested in rust-lang/rust#43535 This is a quick fix to try and suppress the [intermittent 422 errors.](#24) <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/homu/134) <!-- Reviewable:end -->
2 parents 4424aed + 878e02e commit 387c218

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

homu/utils.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import time
99

1010

11-
def github_set_ref(repo, ref, sha, *, force=False, auto_create=True):
11+
def github_set_ref(repo, ref, sha, *, force=False, auto_create=True, retry=1):
1212
url = repo._build_url('git', 'refs', ref, base_url=repo._api)
1313
data = {'sha': sha, 'force': force}
1414

@@ -20,6 +20,14 @@ def github_set_ref(repo, ref, sha, *, force=False, auto_create=True):
2020
return repo.create_ref('refs/' + ref, sha)
2121
except github3.models.GitHubError:
2222
raise e
23+
elif e.code == 422 and retry > 0:
24+
time.sleep(5)
25+
return github_set_ref(repo,
26+
ref,
27+
sha,
28+
force=force,
29+
auto_create=auto_create,
30+
retry=retry - 1)
2331
else:
2432
raise
2533

0 commit comments

Comments
 (0)