Last active
October 23, 2024 14:10
-
-
Save wbotelhos/fb865fba2b4f3518c8e533c7487d5354 to your computer and use it in GitHub Desktop.
Clear Sidekiq Jobs
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
require 'sidekiq/api' | |
# 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 | |
# Stats | |
stats = Sidekiq::Stats.new | |
stats.queues | |
# {"production_mailers"=>25, "production_default"=>1} | |
# Queue | |
queue = Sidekiq::Queue.new('queue_name') | |
queue.count | |
queue.clear | |
queue.each { |job| job.item } # hash content | |
# Redis Acess | |
Sidekiq.redis { |redis| redis.keys } | |
# ["stat:queues"... |
Yes! @wbotelhos that's a good idea
I was doing something wrong with Sidekiq::Testing.disable!
i fixed and now works
Thanks a lot for u help!
Great, @DaniPB! 👏
I loved your editor hearts ^^
This is amazing! thank you
thank you !
It was very helpful. Thanks a a lot.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I see @DaniPB,
Maybe you can mock Redis and do the chances there, if Sidekiq writes there.
https://github.com/sds/mock_redis
https://github.com/guilleiguaran/fakeredis