Skip to content

Commit

Permalink
fix: retry on transient Cloudflare errors
Browse files Browse the repository at this point in the history
  • Loading branch information
nejch committed Apr 3, 2023
1 parent c776541 commit 6a57c2b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/poetry/utils/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,18 @@
RETRY_AFTER_HEADER = "retry-after"

# Server response codes to retry requests on.
STATUS_FORCELIST = [429, 500, 501, 502, 503, 504]
STATUS_FORCELIST = [
429,
500,
501,
502,
503,
504,
# Cloudflare internal errors may indicate transient errors on the origin server
# https://github.com/cloudflare/cloudflare-docs/blob/9842ebbd3b3539ee64ac75daf766c091b90c7512/content/spectrum/reference/logs.md?plain=1#L41-L45
520,
521,
522,
523,
524,
]
5 changes: 5 additions & 0 deletions tests/utils/test_authenticator.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,11 @@ def callback(
(502, 5),
(503, 5),
(504, 5),
(520, 5),
(521, 5),
(522, 5),
(523, 5),
(524, 5),
],
)
def test_authenticator_request_retries_on_status_code(
Expand Down

0 comments on commit 6a57c2b

Please sign in to comment.