Skip to content

Commit 8f22003

Browse files
fix: add cloudflare timeout to retryable status codes (#1468)
1 parent 0aa6d68 commit 8f22003

5 files changed

Lines changed: 24 additions & 25 deletions

File tree

packages/uipath-platform/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath-platform"
3-
version = "0.1.2"
3+
version = "0.1.3"
44
description = "HTTP client library for programmatic access to UiPath Platform"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

packages/uipath-platform/src/uipath/platform/common/retry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
from ..errors import EnrichedException
1313

14-
RETRYABLE_STATUS_CODES: frozenset[int] = frozenset({408, 429, 502, 503, 504})
14+
RETRYABLE_STATUS_CODES: frozenset[int] = frozenset({408, 429, 502, 503, 504, 524})
1515
NON_RETRYABLE_STATUS_CODES: frozenset[int] = frozenset({400, 401, 403, 404, 413, 422})
1616

1717

packages/uipath-platform/tests/services/test_retry.py

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from uipath.platform.common.retry import (
55
_MAX_BACKOFF_DELAY,
66
_MAX_RETRY_AFTER_DELAY,
7-
RETRYABLE_STATUS_CODES,
87
exponential_backoff_with_jitter,
98
extract_retry_after_from_chain,
109
is_retryable_platform_exception,
@@ -15,26 +14,6 @@
1514
from uipath.platform.errors import EnrichedException
1615

1716

18-
class TestRetryableStatusCodes:
19-
def test_contains_expected_codes(self):
20-
assert 408 in RETRYABLE_STATUS_CODES
21-
assert 429 in RETRYABLE_STATUS_CODES
22-
assert 502 in RETRYABLE_STATUS_CODES
23-
assert 503 in RETRYABLE_STATUS_CODES
24-
assert 504 in RETRYABLE_STATUS_CODES
25-
26-
def test_does_not_contain_non_retryable(self):
27-
assert 400 not in RETRYABLE_STATUS_CODES
28-
assert 401 not in RETRYABLE_STATUS_CODES
29-
assert 403 not in RETRYABLE_STATUS_CODES
30-
assert 404 not in RETRYABLE_STATUS_CODES
31-
assert 500 not in RETRYABLE_STATUS_CODES
32-
assert 501 not in RETRYABLE_STATUS_CODES
33-
34-
def test_is_frozenset(self):
35-
assert isinstance(RETRYABLE_STATUS_CODES, frozenset)
36-
37-
3817
class TestParseRetryAfter:
3918
def test_valid_integer(self):
4019
assert parse_retry_after("120") == 120.0
@@ -170,16 +149,36 @@ def test_timeout_exception(self):
170149
err = httpx.TimeoutException("timed out")
171150
assert is_retryable_platform_exception(err) is True
172151

152+
def test_enriched_408(self):
153+
http_err = _make_http_status_error(408)
154+
err = EnrichedException(http_err)
155+
assert is_retryable_platform_exception(err) is True
156+
173157
def test_enriched_429(self):
174158
http_err = _make_http_status_error(429)
175159
err = EnrichedException(http_err)
176160
assert is_retryable_platform_exception(err) is True
177161

162+
def test_enriched_502(self):
163+
http_err = _make_http_status_error(502)
164+
err = EnrichedException(http_err)
165+
assert is_retryable_platform_exception(err) is True
166+
178167
def test_enriched_503(self):
179168
http_err = _make_http_status_error(503)
180169
err = EnrichedException(http_err)
181170
assert is_retryable_platform_exception(err) is True
182171

172+
def test_enriched_504(self):
173+
http_err = _make_http_status_error(504)
174+
err = EnrichedException(http_err)
175+
assert is_retryable_platform_exception(err) is True
176+
177+
def test_enriched_524_cloudflare_timeout(self):
178+
http_err = _make_http_status_error(524)
179+
err = EnrichedException(http_err)
180+
assert is_retryable_platform_exception(err) is True
181+
183182
def test_enriched_400_not_retryable(self):
184183
http_err = _make_http_status_error(400)
185184
err = EnrichedException(http_err)

packages/uipath-platform/uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/uipath/uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)