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
+14
View File
@@ -37,6 +37,20 @@ services:
stop_grace_period: 2s
haproxy:
ports: !reset []
# свой брокер со своим volume, порт AMQP не публикуется
rabbitmq:
ports: !reset []
# worker со сроками, сравнимыми со временем теста, и без перезапуска: его
# останавливают и убивают сами проверки (design change async-attachments,
# решение 15). Сумма пауз 3 × 5 с больше возврата S3 (~8 с): «Временная
# ошибка» успевает. Значения run_failures.py передаёт тестам (FAULT_WORKER_*)
worker:
restart: "no"
environment:
WORKER__MAX_ATTEMPTS: "4"
WORKER__RETRY_DELAY_SECONDS: "5"
WORKER__JOB_TIMEOUT_SECONDS: "10"
WORKER__GRACEFUL_SHUTDOWN_SECONDS: "2"
# уборщик с grace и интервалом, сравнимыми со временем теста (design
# change upload-consistency, решение 10). Grace 20 с больше границы живой
# загрузки при сроках по умолчанию (2 × 6 + 5 = 17 с): занижать сроки ради