Class: Resque::Queues::StatusController

Inherits:
ActionController::Metal
  • Object
show all
Defined in:
app/controllers/resque/queues/status_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/resque/queues/status_controller.rb', line 4

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