Skip to content

Unique recurring task #376

Answered by hibiken
Unkn0wnCat asked this question in Q&A
Jan 4, 2022 · 1 comments · 11 replies
Discussion options

You must be logged in to vote

@Unkn0wnCat Thank you for opening a discussion!

Have you taken a look at this wiki page on periodic-tasks (https://github.com/hibiken/asynq/wiki/Periodic-Tasks)?

Update:
TLDR; If you have multiple Schedulers running to create periodic tasks but want to avoid enqueueing duplicate tasks, try using TaskID and Retention options.

// This ensures there's only one task with ID "foo" in the default queue, and the task will be kept in the queue for x duration after the task has been successfully processed.
client.Enqueue(task, asynq.TaskID("foo"), asynq.Retention(x))

Also, check issue #369 to see if there's alternative solution available (e.g. We may decide to add another variant of Unique option …

Replies: 1 comment 11 replies

Comment options

You must be logged in to vote
11 replies
@Unkn0wnCat
Comment options

@hibiken
Comment options

@hibiken
Comment options

@Unkn0wnCat
Comment options

@hibiken
Comment options

Answer selected by Unkn0wnCat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants