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
@@ -101,10 +101,11 @@ backend api
# загрузки:
# до тела — 2 × [database] request_timeout_seconds (вход, членство) +
# [uploads] wait_timeout_seconds = 2 × 6 + 5 = 17 с;
# после тела — проверка (до ~4 с) + pending 6 + PUT 5 + ready 6 +
# компенсация 5 ≈ 26 с.
# после тела — проверка (до ~4 с) + pending 6 + PUT 5 + queued 6 +
# публикация 2 + отметка или отмена 6 ≈ 29 с; ветка компенсации после
# неудачной фиксации queued — компенсация 5 вместо публикации, 26 с.
# Тело ограничивают [uploads] body_timeout_seconds (30 с) и timeout
# client; наибольшая длительность загрузки 17 + 30 + 26 ≈ 73 с <
# client; наибольшая длительность загрузки 17 + 30 + 29 ≈ 76 с <
# ROLLOUT_DRAIN_TIMEOUT (90 с, scripts/rolling-update.sh). Остальные
# пути — прежние 10 с. Выражение — путь ручки в API
# (src/api/routers/v1/attachment.py): при смене префикса менять вместе