简体   繁体   中英

Managing Celery Task Results

I am pretty new to Celery and I thought I had read somewhere that the task results only stay around for a limited time. However my backend (redis) is getting pretty bloated after running a lot of tasks through it.

Is there a way to set a TTL on task results or is this something I need to manually purge (and how)?

According to the celery documentation you can completely ignore all results using CELERY_IGNORE_RESULT .

You can also expire results after a set amount of time using CELERY_TASK_RESULT_EXPIRES , which defaults to 1 day. In the notes it says this should just work with the redis backend, whereas some of the other backends require celery beat to be running.

There is also the CELERY_MAX_CACHED_RESULTS setting that caches up to 5,000 results by default.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM