ЛР 5 — БВТ2303 — Голиков — на 5 #69
@@ -297,4 +297,14 @@ func (r *AttachmentRepo) FailJob(ctx context.Context, id string, errorCode strin
|
||||
return mapError(err)
|
||||
}
|
||||
|
||||
func (r *AttachmentRepo) ScheduleRetry(ctx context.Context, id string, nextAttemptAt time.Time, errorCode string) error {
|
||||
const q = `
|
||||
UPDATE attachments
|
||||
SET status = 'queued', error_code = NULL, next_attempt_at = $2, locked_until = NULL, updated_at = now()
|
||||
WHERE id = $1::uuid AND status = 'processing'
|
||||
`
|
||||
_, err := r.pool.Exec(ctx, q, id, nextAttemptAt)
|
||||
return mapError(err)
|
||||
}
|
||||
|
||||
var _ domain.AttachmentRepository = (*AttachmentRepo)(nil)
|
||||
|
||||
Reference in New Issue
Block a user