mcollina / fastq

Fast, in memory work queue
ISC License
932 stars 47 forks source link

Possibility to delay the start of a task? #83

Closed ptgamr closed 6 months ago

ptgamr commented 6 months ago

Hi, I encountered a use-case that I want to dedupe the queue that it won't be doing uneccessary work. Like before I'm pushing to the queue, I will make sure the task doesn't exists in the queue yet..

However, task usually run right away right after I push it into queue.. and 1 second later something else that would trigger the same task, but at this point the prev task is already executing.

is it possible to add a delay to control when the task should start ie queue.push(task, {delay: 2000}) ?

mcollina commented 6 months ago

This is currently not possible, and I think it would complicate the logic significantly. I don't think we should implement this.