Skip to content

Instantly share code, notes, and snippets.

@paresharma
Forked from sharmaparesh/sidekiq.rb
Created January 15, 2019 14:31
Show Gist options
  • Save paresharma/d1b81bc6c71675455674dc01e648e84d to your computer and use it in GitHub Desktop.
Save paresharma/d1b81bc6c71675455674dc01e648e84d to your computer and use it in GitHub Desktop.
Sidekiq
require 'sidekiq/api'
# Clear retry set
Sidekiq::RetrySet.new.clear
# Clear scheduled jobs
Sidekiq::ScheduledSet.new.clear
# Clear 'Dead' jobs statistics
Sidekiq::DeadSet.new.clear
# Clear 'Processed' and 'Failed' jobs statistics
Sidekiq::Stats.new.reset
# Clear specific queue
stats = Sidekiq::Stats.new
stats.queues
# => {"main_queue"=>25, "my_custom_queue"=>1}
queue = Sidekiq::Queue.new('my_custom_queue')
queue.count
queue.clear
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment