add level 5

This commit is contained in:
Матвей
2026-10-26 10:36:01 +03:00
parent ff33b8a7c2
commit 4f6e69cfac
8 changed files with 214 additions and 21 deletions
+7
View File
@@ -87,6 +87,13 @@ async def upload(chat_id: UUID, request: Request, filename: str = Query(...),
# Disabled by default; models a crash after PUT, before INSERT.
if os.environ.get("UPLOAD_FAULT_AFTER_S3_PUT") == "1":
raise ApiError(503, "unavailable", "Инъецирован отказ после S3 PUT")
try:
max_pending = int(os.environ.get("MAX_PENDING_JOBS", "100"))
except ValueError as error:
raise ApiError(503, "unavailable", "Некорректный лимит очереди") from error
if max_pending < 1:
raise ApiError(503, "unavailable", "Некорректный лимит очереди")
await store.ensure_attachment_queue_capacity(connection, max_pending)
attachment = await store.create_attachment(
attachment_id, chat_id, user["id"], filename, content_type,
size, digest.hexdigest(), key, job_id, connection=connection,