Sha256: 680b8c0b1e7c0660b15f99157b93fd04dc151ef7d14124c623436d6ced09794b

Contents?: true

Size: 1.17 KB

Versions: 7

Compression:

Stored size: 1.17 KB

Contents

module Resque
  module Queues
    class StatusController < ActionController::Metal
      def show
        request = params.fetch('request')
        self.response_body =
          case request
          when 'age'
            age(params['queue'])
          when 'size'
            size(params['queue'])
          when 'failures_count'
            Resque.queues_info.failures_count_for_queue(params['queue'])
          when 'threshold_size'
            Resque.queues_info.threshold_size(params.fetch('queue'))
          when 'threshold_age'
            Resque.queues_info.threshold_age(params.fetch('queue'))
          when /^threshold_failures_per_(?<period>\w+)$/
            Resque.queues_info.threshold_failures_count(params.fetch('queue'), $LAST_MATCH_INFO['period'])
          when 'channel'
            Resque.queues_info.channel(params.fetch('queue'))
          else
            0
          end.to_s
      end

      private

      def age(queue)
        queue ? Resque.queues_info.age_for_queue(queue) : Resque.queues_info.age_overall
      end

      def size(queue)
        queue ? Resque.queues_info.size_for_queue(queue) : Resque.queues_info.size_overall
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
resque-integration-3.8.2 app/controllers/resque/queues/status_controller.rb
resque-integration-3.8.1 app/controllers/resque/queues/status_controller.rb
resque-integration-3.8.0 app/controllers/resque/queues/status_controller.rb
resque-integration-3.7.1 app/controllers/resque/queues/status_controller.rb
resque-integration-3.5.1 app/controllers/resque/queues/status_controller.rb
resque-integration-3.5.0 app/controllers/resque/queues/status_controller.rb
resque-integration-3.4.1 app/controllers/resque/queues/status_controller.rb