Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions revup/github/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from revup.types import RevupForgeException, RevupRequestException

TRANSIENT_STATUSES = frozenset({500, 502, 503, 504})
RETRYABLE_GRAPHQL_ERRORS = frozenset({"RESOURCE_LIMITS_EXCEEDED"})


class GitHubEndpoint:
Expand Down Expand Up @@ -127,7 +126,12 @@ async def _graphql_once(self, query: str, **kwargs: Any) -> Any:
return r

async def graphql(
self, query: str, *, max_retries: int = 3, base_delay: float = 1.0, **kwargs: Any
self,
query: str,
*,
max_retries: int = 3,
base_delay: float = 1.0,
**kwargs: Any,
) -> Any:
for attempt in range(max_retries):
try:
Expand All @@ -138,10 +142,3 @@ async def graphql(
msg = "GitHub returned {}".format(e.status)
if not await self._should_retry(attempt, max_retries, base_delay, msg):
raise
except RevupForgeException as e:
retryable = set(e.types) & RETRYABLE_GRAPHQL_ERRORS
if not retryable:
raise
msg = "GitHub GraphQL error ({})".format(", ".join(retryable))
if not await self._should_retry(attempt, max_retries, base_delay, msg):
raise
Loading