Class: Glimpse::Views::Resque

Inherits:
View
  • Object
show all
Defined in:
lib/glimpse/views/resque.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Resque

Returns a new instance of Resque.



6
7
8
# File 'lib/glimpse/views/resque.rb', line 6

def initialize(options = {})
  @queues = options.fetch(:queues, ['*'])
end

Instance Method Details

#contextObject



14
15
16
17
18
19
20
# File 'lib/glimpse/views/resque.rb', line 14

def context
  {
    :jobs => {
      :failures => ::Resque::Failure.count
    }
  }
end

#job_countObject



10
11
12
# File 'lib/glimpse/views/resque.rb', line 10

def job_count
  @queues.collect { |queue| ::Resque.size(queue) }.inject(&:+)
end

#resultsObject



22
23
24
# File 'lib/glimpse/views/resque.rb', line 22

def results
  { :jobs => job_count, :workers => ::Resque.workers.size }
end