[GH-ISSUE #1055] [QUESTION] Does periodic task with the asynq.taskID option lock subsequent schedules? #506

Open
opened 2026-03-02 05:37:56 +03:00 by kerem · 2 comments
Owner

Originally created by @brunocasado on GitHub (Jun 6, 2025).
Original GitHub issue: https://github.com/hibiken/asynq/issues/1055

Hi there,

i have a scheduled task like this:

{
		CronSpec: "@every 1m",
		Task: asynq.NewTask(
			"campaign:email_verification_scheduler",
			[]byte(`{"fixed":"true"}`),
			asynq.TaskID("campaign:email_verification_scheduler"),
			asynq.Timeout(time.Hour*1),
			asynq.MaxRetry(0),
			asynq.Queue("critical"),
		),
		Options: []asynq.Option{},
	},

This is causing this task to run only once.

I saw that this task was archived due to an issue, and since then, this task hasn't been scheduled anymore. As soon as I removed it from the archive, the task was scheduled again. It ran without any issues, but then it stopped being scheduled again.

After I removed the asynq.TaskID, everything started working normally.

Is this a bug or the fact i am setting a hard coded task id is causing this?

thanks in advance

Originally created by @brunocasado on GitHub (Jun 6, 2025). Original GitHub issue: https://github.com/hibiken/asynq/issues/1055 Hi there, i have a scheduled task like this: ``` { CronSpec: "@every 1m", Task: asynq.NewTask( "campaign:email_verification_scheduler", []byte(`{"fixed":"true"}`), asynq.TaskID("campaign:email_verification_scheduler"), asynq.Timeout(time.Hour*1), asynq.MaxRetry(0), asynq.Queue("critical"), ), Options: []asynq.Option{}, }, ``` This is causing this task to run only once. I saw that this task was archived due to an issue, and since then, this task hasn't been scheduled anymore. As soon as I removed it from the archive, the task was scheduled again. It ran without any issues, but then it stopped being scheduled again. After I removed the asynq.TaskID, everything started working normally. Is this a bug or the fact i am setting a hard coded task id is causing this? thanks in advance
Author
Owner

@gaomujin commented on GitHub (Sep 18, 2025):

I guess it's because tasks with TaskID are unique, including those that are archived.

<!-- gh-comment-id:3306576888 --> @gaomujin commented on GitHub (Sep 18, 2025): I guess it's because tasks with TaskID are unique, including those that are archived.
Author
Owner

@RychEmrycho commented on GitHub (Dec 11, 2025):

its by design. asynq will ensure that there's only a task with the given ID lives in the queue. only after the task is removed from the queue (either due to force deletion or completed without retention), then you can enqueue another task with the same ID.

<!-- gh-comment-id:3642957155 --> @RychEmrycho commented on GitHub (Dec 11, 2025): its by design. asynq will ensure that there's only a task with the given ID lives in the queue. only after the task is removed from the queue (either due to force deletion or completed without retention), then you can enqueue another task with the same ID.
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#506
No description provided.