m-barthelemy / vapor-queues-fluent-driver

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

Ensure delayed jobs are ignored until it's time to run them #16

Closed m-barthelemy closed 3 years ago

m-barthelemy commented 3 years ago

Fixes https://github.com/m-barthelemy/vapor-queues-fluent-driver/issues/15

Any job created with the .delayUntil option would always be selected by the driver, then be refused by Queues, and selected over and over again until it was time to run it. This would block the queue.

This was due to not tracking when the delayed job was actually supposed to run at all.

With this PR, delayed jobs will be ignored until it's actually time to run them. To avoid any schema change, the created_at DB field is (ab)used to store the delayUntil date, if present.