Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CELERY_RESULT_EXPIRES does not prevent backend.cleanup task #414

Open
kgeographer opened this issue Nov 25, 2023 · 2 comments
Open

CELERY_RESULT_EXPIRES does not prevent backend.cleanup task #414

kgeographer opened this issue Nov 25, 2023 · 2 comments

Comments

@kgeographer
Copy link

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
Copy link

hetvi01 commented Jun 14, 2024

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.

@saz
Copy link

saz commented Sep 17, 2024

FYI: Since Celery 4, CELERY_RESULT_EXPIRES should be used. CELERY_TASK_RESULT_EXPIRES is still valid, but might be removed in the future.

See also https://github.com/celery/celery/blob/f51c2bd8c175f5ea235da684aed870e5884fa941/docs/history/whatsnew-4.4.rst#configuration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants