Skip to content

Commit

Permalink
refactor: Moving RETRYABLE_TRANSIENT_ERROR_CODES to const
Browse files Browse the repository at this point in the history
  • Loading branch information
lmilbaum authored and nejch committed Dec 6, 2022
1 parent 985b971 commit 887852d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 1 addition & 2 deletions gitlab/client.py
Expand Up @@ -22,7 +22,6 @@
"{source!r} to {target!r}"
)

RETRYABLE_TRANSIENT_ERROR_CODES = [500, 502, 503, 504] + list(range(520, 531))

# https://docs.gitlab.com/ee/api/#offset-based-pagination
_PAGINATION_URL = (
Expand Down Expand Up @@ -781,7 +780,7 @@ def http_request(
return result

if (429 == result.status_code and obey_rate_limit) or (
result.status_code in RETRYABLE_TRANSIENT_ERROR_CODES
result.status_code in gitlab.const.RETRYABLE_TRANSIENT_ERROR_CODES
and retry_transient_errors
):
# Response headers documentation:
Expand Down
2 changes: 2 additions & 0 deletions gitlab/const.py
Expand Up @@ -131,6 +131,8 @@ class SearchScope(GitlabEnum):

USER_AGENT: str = f"{__title__}/{__version__}"

RETRYABLE_TRANSIENT_ERROR_CODES = [500, 502, 503, 504] + list(range(520, 531))

__all__ = [
"AccessLevel",
"Visibility",
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_gitlab_http_methods.py
Expand Up @@ -6,7 +6,7 @@
import responses

from gitlab import GitlabHttpError, GitlabList, GitlabParsingError, RedirectError
from gitlab.client import RETRYABLE_TRANSIENT_ERROR_CODES
from gitlab.const import RETRYABLE_TRANSIENT_ERROR_CODES
from tests.unit import helpers


Expand Down

0 comments on commit 887852d

Please sign in to comment.