celery / django-celery-results

Celery result back end with django
Other
668 stars 206 forks source link

CELERY_RESULT_EXPIRES does not prevent backend.cleanup task #414

Open kgeographer opened 7 months ago

kgeographer commented 7 months ago

I have been using django-celery-results v1.0.2 in an app for a few years successfully. No tasks are ever deleted automatically, and that is essential to my application - result attributes are used in various ways permanently. Occasionally I will clear out some mundane tasks, but certain ones are crucial, and not a huge number.

Now upgrading and updating, to Django 4 from 2, and django-celery-results to 2.5.0, I find that all tasks are wiped daily. I understand this is standard behavior, and that a CELERY_RESULT_EXPIRES = None line in settings.py should prevent the cleanup task from running, but it hasn't.

How can I stop the cleanup?

hetvi01 commented 3 weeks ago

Once cross-verify the version of celery you are using.

In the latest stable version (5.4) of celery, the configuration constant for this setting is CELERY_TASK_RESULT_EXPIRES, not CELERY_RESULT_EXPIRES.

JFYI: Versions of celery greater than 3.0 use CELERY_TASK_RESULT_EXPIRES. I am not certain about the constants used in versions prior to that.

Ensure that the version of celery you are using supports CELERY_RESULT_EXPIRES else try to change the constant.