[Django]-Removing all Celery results from a Redis backend

3👍

Here’s what you’re looking for I think:

https://github.com/celery/celery/issues/4656

referencing

https://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-result_expires

I set this up as follows:

RESULT_EXPIRE_TIME = 60 * 60 * 4  # keep tasks around for four hours

...

celery = celery.Celery('tasks',
                       broker=Config.BROKER_URL,
                       backend=Config.CELERY_RESULTS_BACKEND,
                       include=['tasks.definitions'],
                       result_expires=RESULT_EXPIRE_TIME)
👤aaron

0👍

So based on this answer: How do I delete everything in Redis?

With redis-cli:

FLUSHDB - Removes data from your connection's CURRENT database.
FLUSHALL - Removes data from ALL databases.

Redis documentation:

flushdb
flushall

For example, in your shell:

redis-cli flushall

and try to purge celery as well.
From celery doc: http://docs.celeryproject.org/en/latest/faq.html?highlight=purge#how-do-i-purge-all-waiting-tasks

Leave a comment