Created
July 28, 2014 20:07
-
-
Save tamouse/fe8cd56df75d3ac7b1cd to your computer and use it in GitHub Desktop.
Clearing out sidekiq queues
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
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