2
0
mirror of https://github.com/hibiken/asynq.git synced 2024-09-20 11:05:58 +08:00

Correct the error message to cancel an active tasks

This commit is contained in:
Erwan Leboucher 2022-04-13 10:37:18 +02:00 committed by Ken Hibino
parent dd6f84c575
commit 5c723f597e

View File

@ -1349,7 +1349,7 @@ func (r *RDB) ArchiveTask(qname, id string) error {
case -1: case -1:
return errors.E(op, errors.FailedPrecondition, &errors.TaskAlreadyArchivedError{Queue: qname, ID: id}) return errors.E(op, errors.FailedPrecondition, &errors.TaskAlreadyArchivedError{Queue: qname, ID: id})
case -2: case -2:
return errors.E(op, errors.FailedPrecondition, "cannot archive task in active state. use CancelTask instead.") return errors.E(op, errors.FailedPrecondition, "cannot archive task in active state. use CancelProcessing instead.")
case -3: case -3:
return errors.E(op, errors.NotFound, &errors.QueueNotFoundError{Queue: qname}) return errors.E(op, errors.NotFound, &errors.QueueNotFoundError{Queue: qname})
default: default:
@ -1490,7 +1490,7 @@ func (r *RDB) DeleteTask(qname, id string) error {
case 0: case 0:
return errors.E(op, errors.NotFound, &errors.TaskNotFoundError{Queue: qname, ID: id}) return errors.E(op, errors.NotFound, &errors.TaskNotFoundError{Queue: qname, ID: id})
case -1: case -1:
return errors.E(op, errors.FailedPrecondition, "cannot delete task in active state. use CancelTask instead.") return errors.E(op, errors.FailedPrecondition, "cannot delete task in active state. use CancelProcessing instead.")
default: default:
return errors.E(op, errors.Internal, fmt.Sprintf("unexpected return value from deleteTaskCmd script: %d", n)) return errors.E(op, errors.Internal, fmt.Sprintf("unexpected return value from deleteTaskCmd script: %d", n))
} }