forked from mtusi2026/mtusi2026lab5
feat(lab5): time pipeline stages and centralize variant constants
This commit is contained in:
@@ -12,6 +12,18 @@ import (
|
||||
"github.com/jackc/pgx/v5"
|
||||
)
|
||||
|
||||
// Job state machine. Every transition is a compare-and-set on
|
||||
// (job_id, attempt, status), so broker duplicates and stale workers are
|
||||
// harmless.
|
||||
//
|
||||
// queued --ClaimJob--> processing --CompleteJob--> ready
|
||||
// |
|
||||
// +--ScheduleRetry--> queued (future available_at)
|
||||
// +--FailJob--------> failed
|
||||
// +--attempt >= max-> failed/retry_exhausted
|
||||
// processing with an expired lease --RecoverExpiredLeases--> queued/failed
|
||||
// failed --ReplayFailed--> queued (attempt=0, replay_count+1)
|
||||
//
|
||||
// ClaimResult tells the consumer whether this delivery owns the work.
|
||||
type ClaimResult struct {
|
||||
Job model.JobRecord
|
||||
|
||||
Reference in New Issue
Block a user