feat: bound upload memory with per-replica slots and a body deadline
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -44,9 +44,14 @@ ERROR_CODES = {
|
||||
409: "conflict",
|
||||
413: "payload_too_large",
|
||||
415: "unsupported_media_type",
|
||||
# с change upload-memory: все места загрузки процесса заняты
|
||||
429: "rate_limited",
|
||||
500: "internal_error",
|
||||
503: "unavailable",
|
||||
}
|
||||
# Retry-After у 429 — положительное целое число секунд (спек
|
||||
# api-conventions, «Соответствие статусов и кодов ошибок»)
|
||||
RETRY_AFTER_RE = re.compile(r"^[1-9][0-9]*$")
|
||||
|
||||
|
||||
@cache
|
||||
@@ -144,6 +149,12 @@ def assert_error(resp: httpx.Response, status: int) -> dict[str, Any]:
|
||||
resp,
|
||||
"request_id differs from X-Request-Id",
|
||||
)
|
||||
if status == 429:
|
||||
retry_after = resp.headers.get("Retry-After", "")
|
||||
assert RETRY_AFTER_RE.fullmatch(retry_after), describe(
|
||||
resp,
|
||||
f"Retry-After {retry_after!r} is not a positive integer",
|
||||
)
|
||||
return error
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user