Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to destroy jobs enqueued by resque workers?

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.

like image 821
Kibet Yegon Avatar asked May 04 '11 08:05

Kibet Yegon


2 Answers

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}" } 
like image 83
shedd Avatar answered Sep 21 '22 16:09

shedd


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}" 
like image 32
Dylan Markow Avatar answered Sep 21 '22 16:09

Dylan Markow