Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DJANGO_CELERY_BEAT Periodic Task is not getting scheduled if last_run_at is None and the Database Scheduled is Updated. #818

Open
Akhilesh-Sirohi opened this issue Oct 30, 2024 · 2 comments

Comments

@Akhilesh-Sirohi
Copy link

Akhilesh-Sirohi commented Oct 30, 2024

Summary:

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:

  1. Keep the database-schedule max_interval as 5 sec
  2. 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)
  3. Just before 5 sec before time x, update the database.
  4. 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).
  5. 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.

@cclauss
Copy link
Contributor

cclauss commented Oct 30, 2024

Do the last_run_at pull requests solve this issue?

@Akhilesh-Sirohi
Copy link
Author

Akhilesh-Sirohi commented Nov 1, 2024

@cclauss yes, pull request #717 will solve the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants