2
0
mirror of https://github.com/hibiken/asynq.git synced 2025-10-23 10:16:12 +08:00

Update rdb.ArchiveTask with more specific error types

This commit is contained in:
Ken Hibino
2021-05-01 16:13:40 -07:00
parent aa2ddaf27d
commit 8c402e104a
3 changed files with 76 additions and 31 deletions

View File

@@ -20,10 +20,16 @@ var (
ErrNoProcessableTask = errors.New("no tasks are ready for processing")
// ErrTaskNotFound indicates that a task that matches the given identifier was not found.
ErrTaskNotFound = errors.New("could not find a task")
ErrTaskNotFound = fmt.Errorf("%w: could not find a task in the queue", base.ErrNotFound)
// ErrTaskAlreadyArchived indicates that the task in question is already in archive state.
ErrTaskAlreadyArchived = fmt.Errorf("%w: task is already archived", base.ErrFailedPrecondition)
// ErrDuplicateTask indicates that another task with the same unique key holds the uniqueness lock.
ErrDuplicateTask = errors.New("task already exists")
// ErrQueueNotFound indicates that a queue with the given name does not exist.
ErrQueueNotFound = fmt.Errorf("%w: queue does not exist", base.ErrNotFound)
)
const statsTTL = 90 * 24 * time.Hour // 90 days