Skip to content

Commit

Permalink
fix long period task will never be triggered
Browse files Browse the repository at this point in the history
  • Loading branch information
daydaychen authored and chentiantian committed Jan 19, 2024
1 parent 00f0a5c commit 64570cc
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions django_celery_beat/schedulers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 64570cc

Please sign in to comment.