How to destroy jobs enqueued by resque workers?

Kibet Yegon picture Kibet Yegon · May 4, 2011 · Viewed 31k times · Source

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 stack has hit over 1000 jobs. I fixed the issue that caused that many jobs to be queued and now the problem I have is that the jobs created by the bug are still there and therefore It becomes difficult to test something since a job is added to a queue with 1000+ jobs. I can't seem to stop these jobs. I have tried removing the queue from the redis-cli using the flushall command but it didn't work. Am I missing something? coz I can't seem to find a way of getting rid of these jobs.

Answer

shedd picture shedd · Jan 9, 2013

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}" }