lab5: завершение второго ревью
PNG: validate color-type/bit-depth pairs, reject duplicate IHDR/PLTE, non-consecutive IDAT, PLTE after IDAT, and trailing bytes after the zlib stream; keep accepting valid palette, split-IDAT, 16-bit, and Adam7 uploads. Replay: a newer failed unpublished version returns the attachment to queued, while a published ready version stays serving.
This commit is contained in:
@@ -1474,15 +1474,25 @@ func (r *PipelineRepository) ReplayJob(
|
||||
return fmt.Errorf("replay job: %w", mapError(err))
|
||||
}
|
||||
|
||||
if job.PipelineVersion == attachment.PipelineVersion {
|
||||
// Mirror failJobTx: a replay of a newer unpublished version returns
|
||||
// the attachment to queued so the API does not keep showing a stale
|
||||
// terminal state while the replayed job waits. A published ready
|
||||
// version is never disturbed by a newer version's replay.
|
||||
switch {
|
||||
case job.PipelineVersion == attachment.PipelineVersion:
|
||||
_, err = tx.Exec(ctx, `
|
||||
UPDATE attachments
|
||||
SET status = 'queued', error_code = NULL, failed_at = NULL, updated_at = now()
|
||||
WHERE id = $1 AND pipeline_version = $2`,
|
||||
attachment.ID, job.PipelineVersion)
|
||||
if err != nil {
|
||||
return fmt.Errorf("replay attachment: %w", mapError(err))
|
||||
}
|
||||
case job.PipelineVersion > attachment.PipelineVersion && attachment.Status != domain.AttachmentReady:
|
||||
_, err = tx.Exec(ctx, `
|
||||
UPDATE attachments
|
||||
SET status = 'queued', error_code = NULL, failed_at = NULL, updated_at = now()
|
||||
WHERE id = $1 AND status <> 'ready'`, attachment.ID)
|
||||
}
|
||||
if err != nil {
|
||||
return fmt.Errorf("replay attachment: %w", mapError(err))
|
||||
}
|
||||
|
||||
if err := insertEventTx(ctx, tx, job.ID, domain.EventReplayed, nextAttempt, ""); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user