vgarvardt / gue

Golang queue on top of PostgreSQL
MIT License
278 stars 23 forks source link

prevent enqueuing same job, #198

Open mcbenjemaa opened 1 year ago

mcbenjemaa commented 1 year ago

Any idea how to prevent enqueuing same job?

Maybe like if a job with same args exists More then 3 then we can prevent enqueuing it again?

vgarvardt commented 1 year ago

Same as in https://github.com/vgarvardt/gue/issues/197 - jobs do not know anything about other jobs unless you implement some additional functionality to track created jobs. This is simple queuing system focused on strong consistency.

Insteadof commented 1 year ago

I'm facing a similar problem where i don't want to enqueue certain jobs multiple times. My case would be solved if i have control over the generated id in the execEnqueue func, thinking about creating a PR for this...

berkantay commented 1 year ago

just an idea but i am tend to have a brainstorm here about this issue, could we generate the task id based on the other columns. like similar to sonyflake?

so that if an identical task in enqueued into the jobs gue can discard it automatically