Skip to content

Instantly share code, notes, and snippets.

@elchingon
Forked from wbotelhos/clear-sidekiq-jobs.sh
Created August 22, 2017 15:08
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 elchingon/82cb7c26c50e6eaf8385a3b6dd4446a8 to your computer and use it in GitHub Desktop.
Save elchingon/82cb7c26c50e6eaf8385a3b6dd4446a8 to your computer and use it in GitHub Desktop.
Clear Sidekiq Jobs
# 1. Clear retry set
Sidekiq::RetrySet.new.clear
# 2. Clear scheduled jobs
Sidekiq::ScheduledSet.new.clear
# 3. Clear 'Processed' and 'Failed' jobs
Sidekiq::Stats.new.reset
# 3. Clear 'Dead' jobs statistics
Sidekiq::DeadSet.new.clear
# Via API
require 'sidekiq/api'
stats = Sidekiq::Stats.new
stats.queues
# {"production_mailers"=>25, "production_default"=>1}
queue = Sidekiq::Queue.new('queue_name')
queue.count
queue.clear
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment