-
-
Save frankyston/0e3317c5c797a3640cfba0a0f49b2d50 to your computer and use it in GitHub Desktop.
Clear Sidekiq Jobs
This file contains hidden or 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
# 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 |
As a side note, require 'sidekiq/api'
must be first if you are in rails console
Yes! @wbotelhos that's a good idea
I was doing something wrong with Sidekiq::Testing.disable! i fixed and now works
https://user-images.githubusercontent.com/30449248/83050776-a701f400-a012-11ea-89f7-7cf0413ff910.png
Thanks a lot for u help!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sidekiq::Queue.all.each {|q| q.clear}
is a handy way to clear all queues