forked from mtusi2026/mtusi2026lab5
feat(lab5): durable async attachment pipeline through grade 4
- RabbitMQ quorum queue, persistent messages and publisher confirms - S3 staging plus PostgreSQL attachments/jobs outbox transaction - worker variants (thumbnail, crop, optimized WebP), DB lease and lease sweeper - jittered retry, permanent failures, explicit replay and admission cap - deterministic crash hooks, resilience script and evidence for grade 4 - async-aware custom tests, oversized pixel case, docs and changelog
This commit is contained in:
+13
-1
@@ -12,10 +12,13 @@ import (
|
||||
|
||||
"gitflic.ru/project/bulla-max/mtusi2026lab/internal"
|
||||
"gitflic.ru/project/bulla-max/mtusi2026lab/internal/attachments"
|
||||
"gitflic.ru/project/bulla-max/mtusi2026lab/internal/broker"
|
||||
"gitflic.ru/project/bulla-max/mtusi2026lab/internal/config"
|
||||
"gitflic.ru/project/bulla-max/mtusi2026lab/internal/database"
|
||||
"gitflic.ru/project/bulla-max/mtusi2026lab/internal/health"
|
||||
"gitflic.ru/project/bulla-max/mtusi2026lab/internal/outbox"
|
||||
"gitflic.ru/project/bulla-max/mtusi2026lab/internal/session"
|
||||
"gitflic.ru/project/bulla-max/mtusi2026lab/internal/store"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -52,7 +55,16 @@ func main() {
|
||||
|
||||
attachments.CleanupStaleUploads(cfg.UploadTempDir, time.Hour)
|
||||
|
||||
app, err := internal.New(cfg, pool, sessions)
|
||||
st := store.New(pool, cfg.DBTimeout, cfg.IdempotencyTTL)
|
||||
|
||||
// AGENT: the outbox publisher runs in every API replica. Duplicate
|
||||
// publication is harmless because workers claim by job_id; the important
|
||||
// property is that a committed intent is retried until a confirm.
|
||||
publisher := broker.NewPublisher(cfg.BrokerURL, cfg.JobQueue)
|
||||
defer publisher.Close()
|
||||
go outbox.New(st, publisher, nil).Run(rootCtx)
|
||||
|
||||
app, err := internal.New(cfg, st, sessions)
|
||||
if err != nil {
|
||||
log.Fatalf("application: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user