Versions in this module Expand all Collapse all v0 v0.1.0 Nov 9, 2026 Changes in this version + const StateCancelled + const StateFailed + const StateQueued + const StateRunning + const StateSucceeded + var ErrFinished = errors.New("queue: the task has finished") + var ErrNotFound = errors.New("queue: task not found") + var ErrNotRetrying = errors.New("queue: only failed or cancelled tasks can be retried") + var ErrUnknownKind = errors.New("queue: unknown task kind") + func DefaultBackoff(attempts int32) time.Duration + func Permanent(err error) error + type Event struct + Attempts int32 + ID uuid.UUID + Kind string + LastError string + Progress *Progress + State string + type Handler func(ctx context.Context, t *Task) (result any, err error) + type Kind struct + Concurrency int + Handler Handler + MaxAttempts int + type KindState struct + Concurrency int + Kind string + Paused bool + Running int + type NewTask struct + CreatedBy uuid.UUID + DedupeKey string + Kind string + LimitKey string + Payload any + Priority int32 + RunAfter time.Time + type Progress struct + Done int64 + Phase string + Total int64 + Unit string + type Queue struct + Backoff func(attempts int32) time.Duration + Lease time.Duration + Poll time.Duration + Workers int + func New(st *store.Store, hub *events.Hub, lim *limits.Registry, m *metrics.Metrics, ...) *Queue + func (q *Queue) Cancel(ctx context.Context, id uuid.UUID) (db.Task, error) + func (q *Queue) Enqueue(ctx context.Context, n NewTask) (db.Task, bool, error) + func (q *Queue) EnqueueWith(ctx context.Context, dbq *db.Queries, n NewTask) (db.Task, bool, error) + func (q *Queue) Get(ctx context.Context, id uuid.UUID) (db.Task, error) + func (q *Queue) Kinds() []string + func (q *Queue) Register(kind string, k Kind) + func (q *Queue) Retry(ctx context.Context, id uuid.UUID) (db.Task, error) + func (q *Queue) Run(ctx context.Context) error + func (q *Queue) SetPaused(kind string, paused bool) error + func (q *Queue) State() []KindState + type RetryAfterError struct + After time.Duration + Err error + func (e *RetryAfterError) Error() string + func (e *RetryAfterError) Unwrap() error + type Task struct + func (t *Task) Decode(v any) error + func (t *Task) SetProgress(p Progress)