From 64570ccc42e3f28a1f6f4a0de8a90cc1fe217ff5 Mon Sep 17 00:00:00 2001 From: chentt <7448203+daydaychen@users.noreply.github.com> Date: Fri, 19 Jan 2024 14:10:04 +0800 Subject: [PATCH] fix long period task will never be triggered --- django_celery_beat/schedulers.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/django_celery_beat/schedulers.py b/django_celery_beat/schedulers.py index 846b97a9..6b6680f9 100644 --- a/django_celery_beat/schedulers.py +++ b/django_celery_beat/schedulers.py @@ -84,13 +84,7 @@ def __init__(self, model, app=None): self.model = model if not model.last_run_at: - model.last_run_at = self._default_now() - # if last_run_at is not set and - # model.start_time last_run_at should be in way past. - # This will trigger the job to run at start_time - # and avoid the heap block. - if self.model.start_time: - model.last_run_at = model.last_run_at \ + model.last_run_at = self._default_now() \ - datetime.timedelta(days=365 * 30) self.last_run_at = model.last_run_at