-
-
Save albertvolkman/d025c5e58611c6447f76 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 | |
puts "Clearing out old queues..." | |
Resque.queues.each do |queue_name| | |
Resque.remove_queue(queue_name) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment