sidekiq_alive
                                
                                
                                
                                    sidekiq_alive copied to clipboard
                            
                            
                            
                        Queue is not removed when sidekiq stops

I am currently doing this daily to deal with this issue:
Sidekiq::Queue
  .all
  .select { |q| q.name =~ /^sidekiq_alive-/ }
  .select { |q| q.any? { |w| w.created_at < 1.day.ago } }
  .each(&:clear)
Obviously not ideal, but helps for the time being.
This is the script I wrote to remove all sidekiq-alive queues that don't have a registered instance (zombie queues).
queues = Sidekiq::Queue.all
queues.each do |queue|
  next unless queue.name.starts_with? 'sidekiq_alive-'
  registered_queues = SidekiqAlive.registered_instances.map { |i| "sidekiq_alive-#{i.split('::')[1]}" }
  next if registered_queues.include? queue.name
  puts "Clearing queue #{queue.name}"
  queue.clear
end