Skip to content
Draft
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
2 changes: 1 addition & 1 deletion src/volcano_sdk/_tests/test_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def handle(request: httpx.Request) -> httpx.Response:
assert type(caught.value) is expected
assert caught.value.status == status
assert caught.value.code == "contract_code"
assert caught.value.retry_after == (17 if status == 429 else None)
assert caught.value.retry_after == (17 if status in {429, 503} else None)
assert len(requests) == 1
assert requests[0].method == "POST"
assert requests[0].url == "https://api.test.volcano.dev/auth/signin"
Expand Down
3 changes: 2 additions & 1 deletion src/volcano_sdk/_transport_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
HTTP_RATE_LIMITED,
HTTP_SERVER_ERROR_MAX,
HTTP_SERVER_ERROR_MIN,
HTTP_SERVICE_UNAVAILABLE,
RETRY_AFTER_HEADER,
GeneratedTransportResponse,
JSONResponse,
Expand Down Expand Up @@ -189,7 +190,7 @@ def response_payload(response: TransportResponse, expected_status: int) -> objec
code_value = payload.get("code")
code = str(code_value) if code_value is not None else None
retry_after = None
if status == HTTP_RATE_LIMITED:
if status in {HTTP_RATE_LIMITED, HTTP_SERVICE_UNAVAILABLE}:
retry_after_value = header(response.headers, RETRY_AFTER_HEADER)
try:
retry_after = (
Expand Down
1 change: 1 addition & 0 deletions src/volcano_sdk/_transport_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@


HTTP_RATE_LIMITED = 429
HTTP_SERVICE_UNAVAILABLE = 503


HTTP_OK = 200
Expand Down
Loading