Sha256: 05e53fbb10968d623ff88eab5d233cfcc915048cc78213c64569a63df8fde04d

Contents?: true

Size: 580 Bytes

Versions: 7

Compression:

Stored size: 580 Bytes

Contents

module Resque
  module Integration
    class QueuesInfo
      class Size
        def initialize(config)
          @config = config
        end

        def size(queue)
          Resque.size(queue) || 0
        end

        def overall
          max = 0

          Resque.queues.each do |queue|
            size = Resque.size(queue).to_i
            next if size < threshold(queue)
            max = size if size > max
          end

          max
        end

        private

        def threshold(queue)
          @config.max_size(queue)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
resque-integration-3.8.2 lib/resque/integration/queues_info/size.rb
resque-integration-3.8.1 lib/resque/integration/queues_info/size.rb
resque-integration-3.8.0 lib/resque/integration/queues_info/size.rb
resque-integration-3.7.1 lib/resque/integration/queues_info/size.rb
resque-integration-3.5.1 lib/resque/integration/queues_info/size.rb
resque-integration-3.5.0 lib/resque/integration/queues_info/size.rb
resque-integration-3.4.1 lib/resque/integration/queues_info/size.rb