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:
2026-10-22 00:23:37 +03:00
co-authored by Claude Opus 5.5
parent fc1524d0d6
commit 6cab9d3c41
55 changed files with 4133 additions and 209 deletions
+11
View File
@@ -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