m-barthelemy / vapor-queues-fluent-driver

A Fluent implementation for https://github.com/vapor/queues (Vapor4)
MIT License
32 stars 16 forks source link

Delayed Job pauses entire Queue #15

Closed grahamburgsma closed 3 years ago

grahamburgsma commented 3 years ago

I have discovered an urgent issue that paused my entire job queue in production. Would appreciate any help to get this fixed ASAP.

It seems that delaying a job will pause the queue. I assume it does this because the delayed job is the next in line to be processed (popped off the queue), but it is not yet scheduled to run and so it keeps popping then skipping the same job.

Code used to delay job: queue.dispatch(MyJob.self, payload, delayUntil: futureDate)

I have temporarily fixed this by setting the createdAt timestamp to the delayed timestamp which has cleared out the queue for now.

m-barthelemy commented 3 years ago

Hi, thanks for reporting the issue!

Indeed, until now delayed jobs were treated as any regular job, the delayUntil value was completely ignored by this driver. https://github.com/m-barthelemy/vapor-queues-fluent-driver/pull/16 fixes it.

jnordberg commented 3 years ago

I'm having this issue even with 1.2.0, does this fix apply to jobs created prior to 1.2.0 or do I need to run some migration to unstick my queue?

m-barthelemy commented 3 years ago

@jnordberg unfortunately your jobs that already exist in the _jobs table are still affected by the issue indeed; you'd need to either delete them or update their created_at field to reflect the timestamp you want them to be really run.