I\'m using Resque on a rails-3 project to handle jobs that are scheduled to run every 5 minutes. I recently did something that snowballed the creation of these jobs and the stac
If you pop open a rails console, you can run this code to clear out your queue(s):
queue_name = "my_queue"
Resque.redis.del "queue:#{queue_name}"
This is what works now:
Resque.remove_queue("...")
Updated rake task for clearing (according to latest redis commands changes): https://gist.github.com/1228863
Playing off of the above answers, if you need to clear all of your queues, you could use the following:
Resque.queues.each{|q| Resque.redis.del "queue:#{q}" }
Resque already has a method for doing this - try Resque.remove_queue(queue_name)
(see the documentation here). Internally it performs Resque.redis.del()
, but it also does other cleanup, and by using an api method (rather than making assumptions about how resque works) you'll be more future-proof.
It's safer and bulletproof to use the Resque API rather than deleting everything on the Resque's Redis. Resque does some cleaning in the inside.
If you want to remove all queues and associated enqueued jobs:
Resque.queues.each {|queue| Resque.remove_queue(queue)}
The queues will be re-created the next time a job is enqueued.
Documentation