[GH-ISSUE #751] [BUG] Task retried after deadline #2394

Open
opened 2026-03-15 20:20:13 +03:00 by kerem · 2 comments
Owner

Originally created by @am-fmc on GitHub (Sep 26, 2023).
Original GitHub issue: https://github.com/hibiken/asynq/issues/751

Originally assigned to: @hibiken on GitHub.

Describe the bug
If the server takes a task with an expired deadline it moves the task to be retried. It has no sense, a task with a expired deadline shouldn’t be retried. Also the handler is no executed so i don’t have the chance of do something with the task

To Reproduce

func main() {
	cli := asynq.NewClient(asynq.RedisClientOpt{Addr: "localhost:6379"})
	defer cli.Close()

	task := asynq.NewTask("foo", []byte("payload"), asynq.Deadline(time.Now().Add(-24*time.Hour)))

	tInf, err := cli.Enqueue(task)
	if err != nil {
		log.Fatalln(err)
	}
	log.Println(tInf.ID)
}

Expected behavior
If the task has an expired deadline an special handler should be executed. It shouldn’t be retried

Originally created by @am-fmc on GitHub (Sep 26, 2023). Original GitHub issue: https://github.com/hibiken/asynq/issues/751 Originally assigned to: @hibiken on GitHub. **Describe the bug** If the server takes a task with an expired deadline it moves the task to be retried. It has no sense, a task with a expired deadline shouldn’t be retried. Also the handler is no executed so i don’t have the chance of do something with the task **To Reproduce** ``` func main() { cli := asynq.NewClient(asynq.RedisClientOpt{Addr: "localhost:6379"}) defer cli.Close() task := asynq.NewTask("foo", []byte("payload"), asynq.Deadline(time.Now().Add(-24*time.Hour))) tInf, err := cli.Enqueue(task) if err != nil { log.Fatalln(err) } log.Println(tInf.ID) } ``` **Expected behavior** If the task has an expired deadline an special handler should be executed. It shouldn’t be retried
Author
Owner

@kamikazechaser commented on GitHub (Sep 26, 2023):

Possible issue with processor.handleFailedMessage

<!-- gh-comment-id:1735272489 --> @kamikazechaser commented on GitHub (Sep 26, 2023): Possible issue with `processor.handleFailedMessage`
Author
Owner

@saurori commented on GitHub (Dec 31, 2023):

I also encountered this behavoir and it doesn't really make sense. However, this may be working as intended as described in the CHANGELOG. But there is no way to even handle the retry, it just gets stuck in a loop.

<!-- gh-comment-id:1872655779 --> @saurori commented on GitHub (Dec 31, 2023): I also encountered this behavoir and it doesn't really make sense. However, this may be working as intended as described in the [CHANGELOG](https://github.com/hibiken/asynq/blob/v0.24.1/CHANGELOG.md?plain=1#L348). But there is no way to even handle the retry, it just gets stuck in a loop.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/asynq#2394
No description provided.