Добавить версии pipeline и защиту от устаревших попыток

This commit is contained in:
TAskMAster339
2026-11-05 23:46:31 +03:00
parent 2da0b16383
commit c8ff31e5ff
16 changed files with 350 additions and 47 deletions
+6 -1
View File
@@ -134,13 +134,18 @@ func consumeJobs(ctx context.Context, store *repositories.AttachmentStore, objec
task, cancel := context.WithTimeout(ctx, timeout+15*time.Second)
token, workErr := store.StartAttempt(task, job, timeout+15*time.Second, maxAttempts)
if workErr == nil && token != "" {
faults.Crash("before_effect", job.AttachmentID)
faults.Pause(task, "after_claim", job.AttachmentID)
workErr = store.ProcessJob(task, job, token, maxAttempts, func(a repositories.Attachment, staging string) ([]repositories.Variant, string, error) {
return processImage(task, objects, a, staging)
})
}
cancel()
if errors.Is(workErr, repositories.ErrStaleJob) {
faults.Observe("stale_rejected", job.AttachmentID)
}
completed := token != "" && workErr == nil
if workErr == nil && token == "" {
if workErr == nil && token == "" || errors.Is(workErr, repositories.ErrStaleJob) {
completed, workErr = store.JobTerminal(ctx, job.ID)
}
// Ack after COMMIT of ready/failed or durable retry intent, or terminal no-op.