Closed Deekor closed 6 months ago
Huh, no one's ever asked for that before.
My initial reaction is negative. Locks should be used sparingly and jobs should be idempotent. Imagine an hourly periodic job; It would be easy for the app to store the "last_run_at" timestamp and only execute if 24 hours has passed. The other 23 instances would just return early and do nothing.
It would be easy for the app to store the "last_run_at" timestamp and only execute if 24 hours has passed. The other 23 instances would just return early and do nothing.
Sure, and that is what were doing, seemed like it would be nice if faktory handled it for us.
Just like the
unique_for
ENT feature, but keep the unique constraint after the job has finished.For example: You have a job you are meant to only queue once a day, putting
unique_after: 23.hours
would prevent queuing that job again for another 23 hours even if there is no instances of that job running.