Created
June 26, 2014 19:19
-
-
Save arturo-c/d779e1efa1329ef8a66a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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