feat: add job outbox, relay, leases and image variants to the pipeline

Move publishing out of the upload path: a relay process publishes queued
jobs with confirms. Add lease and attempt fencing, backoff with jitter, a
per-job render process with CPU and memory limits, crop and optimized
variants, the failed registry with audited replay, and staging cleanup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-31 15:36:15 +03:00
co-authored by Claude Opus 5.5
parent 99a222eee2
commit e2a6427c24
102 changed files with 9499 additions and 1916 deletions
+16 -9
View File
@@ -213,15 +213,22 @@ API» называет все четыре.
`[broker]` (класс `Broker`, design change `async-attachments`, решение 13):
`host`, `port`, `user`, `password` (`SecretStr`) — мосты из `RABBITMQ_*` в `.env`,
в docker — `x-broker-env`; `connect_timeout_seconds` (2),
`publish_timeout_seconds` (2; при смене пересчитать цепочку LB: после тела 29 с
< `timeout server` 30 с). `[worker]` (класс `Worker`): `concurrency` (2), `max_attempts`
(5), `job_timeout_seconds` (60), `retry_delay_seconds` (10),
`graceful_shutdown_seconds` (8, ≤ 9), `reconnect_seconds` (2). Подмена — `BROKER__*`,
`WORKER__*`. Ключи worker `S3_WORKER_*` — в `.env`, контейнеру — `environment`
compose, консоль — `make run_worker` (мост `S3__*` в `.env` — ключи API). Имена
skeleton: `BROKER_URL_FILE` → мосты `RABBITMQ_*`; `WORKER_CONCURRENCY`,
`JOB_MAX_ATTEMPTS`, `JOB_TIMEOUT_SECONDS` → поля `[worker]`;
`STAGING_RETENTION_SECONDS` — поля пока нет, появится с очисткой staging.
`publish_timeout_seconds` (2; секцию читают relay и worker, в цепочку LB больше не
входит). `[worker]` (класс `Worker`, design change `pipeline-reliability`, решение
12): `concurrency` (2), `prefetch` (2), `max_attempts` (5), `job_timeout_seconds` (60),
`lease_margin_seconds` (10), `retry_base_delay_seconds` (5), `retry_max_delay_seconds`
(300, не меньше основы), `render_timeout_seconds` (40, меньше срока попытки),
`render_cpu_limit_seconds` (15), `render_memory_limit_mib` (450),
`graceful_shutdown_seconds` (8, ≤ 8), `reconnect_seconds` (2). Прежний ключ
`retry_delay_seconds` в существующем `config.toml` молча игнорируется. `[relay]` (класс
`Relay`): `poll_interval_seconds` (0,25), `batch_size` (100), `max_published_backlog`
(1000, 0 — без предела), `republish_after_seconds` (300), `failure_pause_seconds` (2).
`[cleaner] staging_retention_seconds` (86400). Подмена — `BROKER__*`, `WORKER__*`,
`RELAY__*`. Ключи worker `S3_WORKER_*` — в `.env`, контейнеру — `environment`
compose, консоль — `make run_worker` (мост `S3__*` в `.env` — ключи API); `make
run_relay` — те же мосты. Имена skeleton: `BROKER_URL_FILE` → мосты `RABBITMQ_*`;
`WORKER_CONCURRENCY`, `JOB_MAX_ATTEMPTS`, `JOB_TIMEOUT_SECONDS` → поля `[worker]`;
`STAGING_RETENTION_SECONDS` → `[cleaner] staging_retention_seconds`.
### Уборщик (с лабы 4)