2019-05-21 22:26:51 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require File.expand_path("../../config/environment", __FILE__)
|
|
|
|
|
|
|
|
queues =
|
|
|
|
%w[default low ultra_low critical].map { |name| Sidekiq::Queue.new(name) }.lazy.flat_map(&:lazy)
|
|
|
|
|
|
|
|
stats = Hash.new(0)
|
|
|
|
|
|
|
|
queues.each { |j| stats[j.klass] += 1 }
|
|
|
|
|
|
|
|
stats.sort_by { |a, b| -b }.each { |name, count| puts "#{name}: #{count}" }
|
|
|
|
|
|
|
|
dupes = Hash.new([])
|
|
|
|
queues.each do |j|
|
|
|
|
key = "#{j.klass} #{j.args}"
|
|
|
|
dupes[key] << j
|
|
|
|
end
|
|
|
|
|
|
|
|
total = 0
|
|
|
|
|
|
|
|
dupes.each do |k, jobs|
|
|
|
|
next if jobs.length == 1
|
|
|
|
total += job.length - 1
|
|
|
|
puts "dupe found"
|
|
|
|
p jobs
|
|
|
|
end
|
|
|
|
|
|
|
|
puts
|
2019-05-21 22:28:17 -04:00
|
|
|
puts "#{total} duplicate jobs found!"
|