DJANGO_CELERY_BEAT Periodic Task is not getting scheduled if last_run_at is None and the Database Scheduled is Updated.
Celery Version: 4.4.2
Celery-Beat Version: 2.0.0
Exact steps to reproduce the issue:
Keep the database-schedule max_interval as 5 sec
Create a task to schedule at time x using cron-schedule (task is supposed to run for first time, i.e last_run_at will be None)
Just before 5 sec before time x, update the database.
Now just before the task is supposed to run, the DatabaseScheduler's schedule will start getting updated at time x. (we can also use sleep such that update is going on time x).
After the update, the task will not run.
Detailed information
what is happening here is: if the last_run_at is None then Entry takes the default value as time.now()= time x, so when the is_due fuction checks then it find last_run_at is same as schedule_time, so the task isn't scheduled.
Summary:
DJANGO_CELERY_BEAT Periodic Task is not getting scheduled if last_run_at is None and the Database Scheduled is Updated.
Exact steps to reproduce the issue:
Detailed information
what is happening here is:
if the last_run_at is None then Entry takes the default value as time.now()= time x
, so when theis_due
fuction checks then it find last_run_at is same asschedule_time
, so the task isn't scheduled.