Skip to content

Instantly share code, notes, and snippets.

@arturo-c
Created June 26, 2014 19:19
Show Gist options
  • Save arturo-c/d779e1efa1329ef8a66a to your computer and use it in GitHub Desktop.
Save arturo-c/d779e1efa1329ef8a66a to your computer and use it in GitHub Desktop.
require 'resque'
namespace :resque do
desc "Clear pending tasks"
task :clear do
queues = Resque.queues
queues.each do |queue_name|
puts "Clearing #{queue_name}..."
Resque.redis.del "queue:#{queue_name}"
end
puts "Clearing delayed..." # in case of scheduler - doesn't break if no scheduler module is installed
Resque.redis.keys("delayed:*").each do |key|
Resque.redis.del "#{key}"
end
Resque.redis.del "delayed_queue_schedule"
puts "Clearing stats..."
Resque.redis.set "stat:failed", 0
Resque.redis.set "stat:processed", 0
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment