lab5: асинхронная очередь, worker и идемпотентный pipeline

API принимает 202 после durable staging и TX intent (job+outbox); отдельные relay и worker публикуют/обрабатывают задания с publisher confirm, lease, retry/backoff, DLQ и replay. Добавлены версии pipeline, варианты thumbnail/crop/optimized, presign в verified staging, status-aware sweeper и admission control.
This commit is contained in:
Vladislav Kunetskiy
2026-10-30 22:36:52 +03:00
parent 6c5ba026f1
commit 4bdcac3dfa
95 changed files with 8466 additions and 764 deletions
+14 -7
View File
@@ -74,23 +74,30 @@ func run(cfg config.Config, log *slog.Logger) error {
return fmt.Errorf("connect object store: %w", err)
}
attachmentRepository := store.Attachments()
pipelineRepository := store.Pipeline()
attachmentService := attachment.NewService(
attachmentRepository,
pipelineRepository,
objectStore,
attachment.Config{
MaxUploadBytes: cfg.S3.MaxUploadBytes,
MaxImagePixels: cfg.S3.MaxImagePixels,
PresignTTL: cfg.S3.PresignTTL,
MaxUploadBytes: cfg.S3.MaxUploadBytes,
MaxImagePixels: cfg.S3.MaxImagePixels,
PresignTTL: cfg.S3.PresignTTL,
PipelineVersion: cfg.Processing.PipelineVersion,
MaxAttempts: cfg.Processing.MaxAttempts,
MaxPendingPerUser: cfg.Admission.MaxPendingPerUser,
MaxPending: cfg.Admission.MaxPending,
MaxStagedBytes: cfg.Admission.MaxStagedBytes,
},
log,
)
sweeper := attachment.NewSweeper(
attachmentRepository,
pipelineRepository,
objectStore,
store,
cfg.S3.SweepGrace,
cfg.Staging.OrphanGrace,
cfg.Staging.FailedRetention,
cfg.S3.SweepInterval,
log,
)
@@ -151,7 +158,7 @@ func run(cfg config.Config, log *slog.Logger) error {
rest.NewHandler(
user.NewService(store.Users()),
chat.NewService(chatRepo),
message.NewService(store.Messages(), attachmentRepository),
message.NewService(store.Messages(), pipelineRepository),
attachmentService,
health.New(pingers...),
sessionService,