Skip to content Skip to sidebar Skip to footer

Destroying / Removing A Queue() In Redis Queue (rq) Programmatically

Given: from redis import Redis from rq import Queue yesterday = Queue('yesterday', connection=Redis()) today = Queue('today', connection=Redis()) I would like to programmatically

Solution 1:

Try the following (you can validate all of this with redis-cli):

yesterday.empty()  # This will wipe out rq:queue:yesterday and all of its contents
del(yesterday)  # Deletes the variable itself
r = Redis()
r.srem('rq:queues', 'rq:queue:yesterday')  # Removed the entry from rq:queues set. The library unfortunately doesn't seem to clean this up by itself.

Post a Comment for "Destroying / Removing A Queue() In Redis Queue (rq) Programmatically"