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:
@@ -51,9 +51,18 @@ paths:
|
||||
сервисе. Ключ в исключения и логи не попадает.
|
||||
- Repo вложений (лаба 4, design change `attachments`, решения 3, 4, 8):
|
||||
- `attachment.py`: `insert_attachment` (`created_at` и `updated_at`
|
||||
одним значением), `mark_ready` (`UPDATE … WHERE status = 'pending'
|
||||
одним значением), `mark_queued` (`UPDATE … WHERE status = 'pending'
|
||||
AND updated_at = created_at RETURNING`, `None` — строки `pending` нет
|
||||
или уборщик пометил её к уборке),
|
||||
или уборщик пометил её к уборке), с лабы 5 (design change
|
||||
`async-attachments`, решения 1–3) `return_to_pending`, `mark_processing`,
|
||||
`return_to_queued`, `commit_ready`, `commit_failed` — условные `UPDATE`,
|
||||
`updated_at` через `greatest`: часы процессов расходятся, а CHECK
|
||||
`updated_at >= created_at` падал бы;
|
||||
`attachment_job.py` (`insert_job`, `lock_job` — `FOR UPDATE`, `get_job`,
|
||||
`get_attachment_job`, `start_attempt`, `return_to_queued` с условием своей
|
||||
попытки, `finish_job`, `mark_published`, `delete_unstarted`) и
|
||||
`attachment_variant.py` (`insert_variant` — `ON CONFLICT DO NOTHING`,
|
||||
`get_variants`, `get_variant`);
|
||||
`get_attachment`, `get_attachments` (до 10 строк по первичному
|
||||
ключу). Значения `content_type` и `status` — `.value` enum на
|
||||
записи и enum в DTO на чтении. Для уборщика (design change
|
||||
|
||||
Reference in New Issue
Block a user