feat: process attachments asynchronously with RabbitMQ and a worker

Upload answers 202 after staging, a queued job in PostgreSQL and a broker
confirm; a separate worker publishes the original and a thumbnail with
bounded retries. Adds the job and variant tables, the broker service, the
worker S3 user, cleanup and reconcile support for staging and variants,
the failure stand with broker and worker, bench and driver updates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-31 06:48:20 +03:00
co-authored by Claude Opus 5.5
parent 40c709a78b
commit ff1a83b6ff
107 changed files with 9765 additions and 993 deletions
+4 -3
View File
@@ -83,9 +83,10 @@ FastAPI, один процесс на реплику; реплик ≥2 за HAP
`Content-Length`, `X-Content-Type-Options: nosniff`; генератор сам
закрывает объект в `finally`, тот же закрыватель — фоновой задачей
ответа на случай, если генератор не начался;
- `variant` — `Literal["original"]` с `Query(json_schema_extra={"enum":
["original"]})`: Literal из одного значения pydantic пишет как
`const`, а контракт — `enum`.
- `variant` — `Literal` четырёх значений контракта, по умолчанию
`original`; в сервис — `AttachmentVariantName` или `None` (оригинал);
- загрузка — `status_code=202`, а не 201: приём, а не создание готового
объекта.
JSON-ручки по-прежнему на `get_db_session`.
- Ошибки — доменные исключения из сервиса. `HTTPException` не бросать.
Статус, `code` и заголовки ответа (`WWW-Authenticate` у 401)