Skip to content

Commit

Permalink
fix 'exipres' not working normal as expected
Browse files Browse the repository at this point in the history
related issuses: 240
  • Loading branch information
x-7 committed Oct 24, 2024
1 parent e3c1ade commit 2296363
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions django_celery_beat/schedulers.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,15 @@ def is_due(self):
)
return schedules.schedstate(False, delay)

# EXPIRED TASK: Disable task when expired
if self.model.expires is not None:
now = self._default_now()

Check warning on line 124 in django_celery_beat/schedulers.py

View check run for this annotation

Codecov / codecov/patch

django_celery_beat/schedulers.py#L124

Added line #L124 was not covered by tests
if getattr(settings, 'DJANGO_CELERY_BEAT_TZ_AWARE', True):
now = maybe_make_aware(self._default_now())

Check warning on line 126 in django_celery_beat/schedulers.py

View check run for this annotation

Codecov / codecov/patch

django_celery_beat/schedulers.py#L126

Added line #L126 was not covered by tests

if now >= self.model.expires:
self._disable(self.model)

Check warning on line 129 in django_celery_beat/schedulers.py

View check run for this annotation

Codecov / codecov/patch

django_celery_beat/schedulers.py#L129

Added line #L129 was not covered by tests

# ONE OFF TASK: Disable one off tasks after they've ran once
if self.model.one_off and self.model.enabled \
and self.model.total_run_count > 0:
Expand Down

0 comments on commit 2296363

Please sign in to comment.