Class: DynoscaleRuby::Worker::Resque

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/dynoscale_ruby/worker/resque.rb

Class Method Summary collapse

Class Method Details

.enabled?Boolean

Returns:

  • (Boolean)


8
9
10
11
12
13
14
15
16
# File 'lib/dynoscale_ruby/worker/resque.rb', line 8

def self.enabled?
  return false if ENV['SKIP_DYNOSCALE_AGENT']

  require 'resque'
  require 'resque_latency'
  true
rescue LoadError
  false
end

.nameObject



28
29
30
# File 'lib/dynoscale_ruby/worker/resque.rb', line 28

def self.name
   'resque'
end

.queue_latenciesObject



18
19
20
21
22
# File 'lib/dynoscale_ruby/worker/resque.rb', line 18

def self.queue_latencies
  queues.map do |queue|
    [queue.name, (::Resque.latency(queue)* 1000).ceil, ::Resque.size(queue)]
	end
end

.queues(source = ::Resque.queues) ⇒ Object



24
25
26
# File 'lib/dynoscale_ruby/worker/resque.rb', line 24

def self.queues(source = ::Resque.queues)
  @@queues ||= source
end