Sha256: 3fe3fd74523921354da31a4b85671675a6fab9e01a44b91400e2e0e98795eeb8

Contents?: true

Size: 737 Bytes

Versions: 4

Compression:

Stored size: 737 Bytes

Contents

if defined?(Resque::Worker)
  Resque.send(:extend, Resque::Additions)
  Resque::Worker.send(:include, Resque::DynamicQueues)
  Resque::Worker.send(:include, Resque::SilenceDone) if ZuoraConnect.configuration.silencer_resque_finish == true
  Resque::Job.send(:include, Resque::SelfLookup)
end

Resque.module_eval do
  # Returns a hash, mapping queue names to queue sizes
  def queue_sizes
    paused_queues = Redis.current.zrange("resque:PauseQueue", 0, -1).map! {|key| key.split("__")[0]}
    queue_names = queues.delete_if{|name| paused_queues.include?(name.split("_")[0])}

    sizes = redis.pipelined do
      queue_names.each do |name|
        redis.llen("queue:#{name}")
      end
    end

    Hash[queue_names.zip(sizes)]
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
zuora_connect-1.7.22 config/initializers/resque.rb
zuora_connect-1.7.21 config/initializers/resque.rb
zuora_connect-1.7.20 config/initializers/resque.rb
zuora_connect-1.7.19 config/initializers/resque.rb