hibiken / asynq

Simple, reliable, and efficient distributed task queue in Go
MIT License
10.04k stars 716 forks source link

[FEATURE REQUEST] Unique option for run time of task #886

Open agorman opened 6 months ago

agorman commented 6 months ago

Is your feature request related to a problem? Please describe. I'm running periodic tasks and I'd like the tasks to be unique until they are done running (reach completed or archived state). Currently the two options for uniqueness are hard to work with for this case. Choosing a time.Duration is difficult because the tasks may have vastly different run times. Making the task unique based on id is also difficult because I'd like to retain completed tasks for a given time for other reasons and if the task goes into archived state I'd have to manually remove it before the task runs again.

Describe the solution you'd like I'd like a unique option that can be tied to the state of a task. Uniqueness would stop being checked if the task was in the archived or completed states.