Skip to content

Instantly share code, notes, and snippets.

@tamouse
Created July 28, 2014 20:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tamouse/fe8cd56df75d3ac7b1cd to your computer and use it in GitHub Desktop.
Save tamouse/fe8cd56df75d3ac7b1cd to your computer and use it in GitHub Desktop.
Clearing out sidekiq queues
class SidekiqUtil
def self.queues
::Sidekiq::Stats.new.queues.keys.map { |name| ::Sidekiq::Queue.new(name) }
end
def self.clear_all
self.queues.each { |q| q.clear }
end
end
namespace :jobs do
desc "Clear out the sidekiq job queue"
task :clear_sidekiq_queue, [:frequency] => :environment do |t, args|
SidekiqUtil.clear_all
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment