Legendary Trio
devlogquedulascheduling

Devlog #6: Cron scheduler design

The cron scheduler in Quedula has one responsibility: periodically check whether there are publications whose time has arrived and send them to the queue.

This sounds simple, but there are nuances. What if the scheduler restarted and missed a few minutes? What if one publication is taking a long time to process and the next one runs with a delay?

Our approach: the scheduler looks at all tasks with status "pending" where scheduled_at <= now(). This ensures that "overdue" tasks also get processed, just a bit late.

To protect against double-execution we use pessimistic locking when selecting tasks from the database.