Class: DynoscaleRuby::Worker::Sidekiq
- Inherits:
-
Object
- Object
- DynoscaleRuby::Worker::Sidekiq
- Includes:
- Singleton
- Defined in:
- lib/dynoscale_ruby/worker/sidekiq.rb
Class Method Summary collapse
- .enabled? ⇒ Boolean
- .name ⇒ Object
- .queue_latencies ⇒ Object
- .queues(source = ::Sidekiq::Queue.all) ⇒ Object
Class Method Details
.enabled? ⇒ Boolean
8 9 10 11 12 13 14 15 |
# File 'lib/dynoscale_ruby/worker/sidekiq.rb', line 8 def self.enabled? return false if ENV['SKIP_DYNOSCALE_AGENT'] require 'sidekiq/api' true rescue LoadError false end |
.name ⇒ Object
27 28 29 |
# File 'lib/dynoscale_ruby/worker/sidekiq.rb', line 27 def self.name 'sidekiq' end |
.queue_latencies ⇒ Object
17 18 19 20 21 |
# File 'lib/dynoscale_ruby/worker/sidekiq.rb', line 17 def self.queue_latencies queues.map do |queue| [queue.name, (queue.latency * 1000).ceil, queue.size] end end |
.queues(source = ::Sidekiq::Queue.all) ⇒ Object
23 24 25 |
# File 'lib/dynoscale_ruby/worker/sidekiq.rb', line 23 def self.queues(source = ::Sidekiq::Queue.all) @@queues ||= source end |