You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Celery beat with a django-celery-beat DatabaseScheduler skips crontab tasks after a clock jump #9
Found while testing Saleor's order expiry (files).
What happens
After a ChronoStack clock jump, Celery beat running Saleor's custom scheduler (saleor.schedulers.schedulers.DatabaseScheduler, a django-celery-beat subclass, with --max-interval 1) never sends Saleor's crontab tasks. These are the gift-card task at 00:00 and the cleanups between 01:00 and 03:00.
The scheduler itself reports the gift-card task as due (is_due=True), but beat never sends it. Beat logs no errors.
Interval tasks (for example expire_orders_task every 5 minutes) keep firing correctly across the same jumps.
Celery's own crontab task (celery.backend_cleanup) also fires correctly.
Restarting beat makes the overdue task fire straight away, and it reschedules itself for the next midnight. A jump after that leaves it stuck again.
Saleor doesn't set beat_cron_starting_deadline, so that option isn't the cause.
In real time these tasks run normally, so this is how ChronoStack interacts with that scheduler, not a Saleor bug.
Root cause
Not found yet. A likely place to start is how DatabaseScheduler caches last_run_at and the schedule state between ticks. It may compare against a time taken before the jump.
Workaround
Declare triggers for those tasks in the scenario instead of relying on beat to send them after a jump.
Done when
Either crontab tasks under a django-celery-beat DatabaseScheduler fire after a jump, or the guide documents the limitation and the trigger workaround.
Activity