Skip to content

Commit ce1cc29

Browse files
committed
Don't retry 404s
1 parent b26bc25 commit ce1cc29

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

potential_closeable_issues.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
GITHUB_TOKEN = os.environ["GITHUB_TOOLS_TOKEN"]
3434

3535

36+
def _is_server_error(exc: Exception) -> bool:
37+
return isinstance(exc, HTTPError) and exc.code >= 500
38+
39+
3640
def check_issue(api: GhApi, issue: Issue) -> list[Issue]:
3741
"""
3842
Look for a chunk like this, collect the PRs:
@@ -71,7 +75,7 @@ def check_issue(api: GhApi, issue: Issue) -> list[Issue]:
7175
word = next(word for word in pr_line.split() if word.startswith("gh-"))
7276
pr_number = int(word.split("-")[1])
7377
try:
74-
for attempt in stamina.retry_context(on=HTTPError):
78+
for attempt in stamina.retry_context(on=_is_server_error):
7579
with attempt:
7680
pr = api.pulls.get(pr_number)
7781
except HTTP404NotFoundError as e:

0 commit comments

Comments
 (0)