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
+18
View File
@@ -112,6 +112,24 @@ paths:
оператор, и она выполнена верно (design change `fix-known-issues`,
решение 5).
## Журнал worker и брокера (с лабы 5)
Спек `service-logging`, «Журнал worker»; design change `async-attachments`,
решение 18. Модуль `attachment_processing_service`, `request_id` — `job_id`:
`info` «Started job attempt», «Attachment became ready» (`variant_width`,
`variant_height`, `variant_size_bytes`, `duration_ms`), «Skipped job message»
(`reason`: `finished`, `unknown`, `busy`); `warning` «Retrying job» (`reason`,
`delay_seconds`), «Attachment failed» (`error_code`, `reason`), «Job waits for
database»; `error` «Dropped malformed job message» — без содержимого, «Job attempt
failed» с traceback. Модуль `worker`: «Started worker» со всеми значениями,
«Stopped worker» с `exit_code`, «Invalid worker settings» мимо structlog, «Stopped
worker before startup». Модуль `broker`: `warning` «Broker is unavailable»,
`info` «Broker is available again», `debug` на публикацию; API: «Uploaded attachment»
— ещё `job_id`, `warning` «Attachment job was not published» (`outcome`:
`cancelled`, `taken`), «Attachment job publish mark failed». «Started API» — ещё
`broker_host`, `broker_port`, `broker_queue`, `broker_publish_timeout_seconds`.
Пароля брокера и тел сообщений в записях нет.
## Чего в логах быть не должно
Рубрика уровня 4: логи полезные, но **без содержимого сообщений**.