I want to use Сelere with Redis as backend, I’ll have a process that create tasks, stores ids and then runs again and checks statuses.
How to clear results and statuses that I don’t need anymore, could I restrict time Сelery stores result ?
Like this:
task_id = task.apply_async().id
store_id(task_id) # my code, doesn't relate to celery
Then I will get tasks and check statuses:
task_id = get_id() # my code, doesn't relate to celery
task = AsyncResult(task_id)
# do something with task
# now I don't need Celery to store this result
2
Answers
Celery save the result for a day by default.
You can however adjust this value with
result_expires
.Here are the docs.
You can mention this in your settings.py:
I limit the expire time to 1 hour (60 * 60 = 3,600). The default value for this is one day (86,400 seconds).