django-celery-beat
django-celery-beat copied to clipboard
DatabaseScheduler does not drop beat_schedule-equivalent PeriodicTasks that were removed from the beat_schedule dict
Summary:
The DatabaseScheduler
picks up tasks from the beat schedule and creates or updates corresponding PeriodicTask
entries on the scheduler's setup but doesn't drop the PeriodicTask
entry if the beat schedule entry corresponding to that task is dropped
- Celery Version:
5.2.3
- Celery-Beat Version:
2.4.0
Exact steps to reproduce the issue:
- Have a
CELERYBEAT_SCHEDULE
setup in your Django settings with a couple of tasks - Start the Celery Beat service with the scheduler as
DatabaseScheduler
. There will bePeriodicTask
entries created in the DB, corresponding to theCELERYBEAT_SCHEDULE
tasks - Stop the Celery Beat service and remove one or more tasks from the
CELERYBEAT_SCHEDULE
setting - Restart the Celery Beat service with the
DatabaseScheduler
scheduler. ThePeriodicTask
entries corresponding to theCELERYBEAT_SCHEDULE
tasks still exist and remain enabled
Detailed information
https://github.com/celery/django-celery-beat/blob/1f1c3638170c5d7620fca09221bb2e9aaea7f2b6/django_celery_beat/schedulers.py#L320
- At this line, we use the default
beat_schedule
and create/updatePeriodicTask
entries corresponding to the same but if there are any tasks dropped in thebeat_schedule
, thePeriodicTask
entries corresponding to the same are not deleted/disabled accordingly
Sounds like the same issue as
- #248?
Hi, I found a solution - check this out
- #768