Добавить версии pipeline и защиту от устаревших попыток
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user