One minute
Clear Sidekiq Jobs Cheat Sheet 💣
Easy way to clean Sidekiq Jobs Cheat-Sheet 💣
Code snippet 📌
❯ require 'sidekiq/api'
# Clear retry set
❯ Sidekiq::RetrySet.new.clear
# Clear scheduled jobs
❯ Sidekiq::ScheduledSet.new.clear
# Clear 'Dead' jobs
❯ Sidekiq::DeadSet.new.clear
# Clear 'Processed' and 'Failed' jobs
❯ Sidekiq::Stats.new.reset
# Clear 'Dead' jobs statistics
❯ Sidekiq::DeadSet.new.clear
# Stats
❯ stats = Sidekiq::Stats.new
❯ stats.queues
# {"default"=>125, "mailers"=>25}
# Queue
❯ queue = Sidekiq::Queue.new('queue_name')
❯ queue.count
❯ queue.clear
❯ queue.each{ |j| puts j.item } # Class & Args
# Redis Access
❯ Sidekiq.redis { |redis| redis.keys }
# ["stat:failed:2019-05-02", "stat:processed:2019-02-21", "stat:processed:2018-10-31"......
Read other posts
comments powered by Disqus