module HireFire::Macro::Sidekiq::Common

@!visibility private

Private Instance Methods

find_each_in_set(set) { |sorted_entry| ... } click to toggle source
# File lib/hirefire/macro/sidekiq.rb, line 71
def find_each_in_set(set)
  cursor = 0
  batch = 1000

  loop do
    entries = ::Sidekiq.redis do |connection|
      if Gem::Version.new(::Sidekiq::VERSION) >= Gem::Version.new("7.0.0")
        connection.zrange set.name, cursor, cursor + batch - 1, "WITHSCORES"
      else
        connection.zrange set.name, cursor, cursor + batch - 1, withscores: true
      end
    end

    break if entries.empty?

    entries.each do |entry, score|
      yield ::Sidekiq::SortedEntry.new(self, score, entry)
    end

    cursor += batch
  end
end
registered_queues() click to toggle source
# File lib/hirefire/macro/sidekiq.rb, line 94
def registered_queues
  ::Sidekiq::Queue.all.map(&:name).to_set
end