Skip to content

Instantly share code, notes, and snippets.

@mfilej
Created November 27, 2018 12:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mfilej/c8aeb4daeb8f237f709d63fca82332b6 to your computer and use it in GitHub Desktop.
Save mfilej/c8aeb4daeb8f237f709d63fca82332b6 to your computer and use it in GitHub Desktop.
namespace :resque do
desc "Clear resque queues"
task clear: :environment do
abort "Can not run outside of development env" unless Rails.env.development?
queues = Resque.queues
queues.each do |queue_name|
puts "Cleaning #{queue_name}..."
Resque.redis.del "queue:#{queue_name}"
end
puts "Cleaning 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