Skip to content

Commit

Permalink
update behavior of app.result_expires to match celery docs
Browse files Browse the repository at this point in the history
Celery documentation indicates that app.result_expires of CELERY_RESULT_EXPIRES should respect values of 0 or None: "A value of None or 0 means results will never expire (depending on backend specifications)."
  • Loading branch information
jjorissen52 committed Jul 21, 2023
1 parent bf6d9a6 commit 075ca88
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions django_celery_results/backends/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ def _forget(self, task_id):

def cleanup(self):
"""Delete expired metadata."""
if not self.expires:
return
self.TaskModel._default_manager.delete_expired(self.expires)
self.GroupModel._default_manager.delete_expired(self.expires)

Expand Down

0 comments on commit 075ca88

Please sign in to comment.