Sha256: b7dbf599f72e68e089b439b49b8a86a1d214c39d9c481fb028b4b5d7037614f5

Contents?: true

Size: 575 Bytes

Versions: 1

Compression:

Stored size: 575 Bytes

Contents

require 'singleton'

module DynoscaleRuby
  module Worker
    class Sidekiq
      include Singleton

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

        require 'sidekiq/api'
        true
      rescue LoadError
        false
      end

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

      def self.queues(source = ::Sidekiq::Queue.all)
        @@queues ||= source
      end

      def self.name
         'sidekiq'
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dynoscale_ruby-1.0.3 lib/dynoscale_ruby/worker/sidekiq.rb