How to clear all the jobs from Sidekiq?
You can do as it says on the issue 1077 or as reported in this blog at noobsippets
Both suggest we do the following, and can be done on rails console:
Sidekiq.redis(&:flushdb)
Caution: This command will clear all redis records. I suggest not using it in production
another approach would be
redis-cli --scan --pattern users: * | xargs redis-cli del
according to this blog
Clear Sidekiq Jobs commands:
require 'sidekiq/api'# Clear retry setSidekiq::RetrySet.new.clear# Clear scheduled jobs Sidekiq::ScheduledSet.new.clear# Clear 'Dead' jobs statisticsSidekiq::DeadSet.new.clear# Clear 'Processed' and 'Failed' jobs statisticsSidekiq::Stats.new.reset# Clear specific queuestats = Sidekiq::Stats.newstats.queues# => {"main_queue"=>25, "my_custom_queue"=>1}queue = Sidekiq::Queue.new('my_custom_queue')queue.countqueue.clear
According to this issue on Github: https://github.com/mperham/sidekiq/issues/1732 you now need to
require 'sidekiq/api'