Skip to content

Instantly share code, notes, and snippets.

@flaviokr
Last active January 3, 2018 18:40
Show Gist options
  • Save flaviokr/a1ab5400747b05255c8847fceb51bdcf to your computer and use it in GitHub Desktop.
Save flaviokr/a1ab5400747b05255c8847fceb51bdcf to your computer and use it in GitHub Desktop.
Sidekiq API Reference
Sidekiq.redis { |conn| conn.flushdb } # clear everything
Sidekiq::Queue.all # get all queues
Sidekiq::Queue.new # get the "default" queue
Sidekiq::Queue.new("mailer") # get the "mailer" queue
Sidekiq::Queue.new.clear # deletes all jobs in a queue, by removing the queue
Sidekiq::Queue.all.each(&:clear) # deletes all jobs in all queues
ss = Sidekiq::ScheduledSet.new
ss.size
ss.clear
jobs = ss.select { |job| job.klass == 'SomeWorker' }
jobs.each(&:delete)
Sidekiq::RetrySet.new
Sidekiq::DeadSet.new
Sidekiq::ProcessSet.new # running processes
Sidekiq::Stats.new.reset # reset statistics
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment