Sha256: 95c924dc615c3c76e382c697e80a8fe462795e8abe195405e868a254e7330519

Contents?: true

Size: 937 Bytes

Versions: 3

Compression:

Stored size: 937 Bytes

Contents

if Gem::Specification.find_all_by_name("sidekiq", ">=1.0.0").count >= 1
  SIDEKIQ_INSTALLED = true
  require 'sidekiq'
  require 'sidekiq/api'
else
  SIDEKIQ_INSTALLED = false
  puts "sidekiq gem not installed, skipping crawl_worker specs" if defined?(ENVIRONMENT) && ENVIRONMENT=="test"
end
if Gem::Specification.find_all_by_name("resque", ">=1.0.0").count >= 1
  RESQUE_INSTALLED = true
  require 'resque'
else
  RESQUE_INSTALLED = false
  puts "resque gem not installed, skipping crawl_job specs" if defined?(ENVIRONMENT) && ENVIRONMENT=="test"
end

module Sidekiq
  module Worker
    module ClassMethods
      def queue_size
        Sidekiq.redis do |conn|
          conn.llen("queue:#{get_sidekiq_options["queue"]}")
        end
      end
      def queue_items(start=0, finish=-1)
        Sidekiq.redis do |conn|
          conn.lrange("queue:#{get_sidekiq_options["queue"]}", start, finish)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cobweb-1.2.1 lib/sidekiq/cobweb_helper.rb
cobweb-1.2.0 lib/sidekiq/cobweb_helper.rb
cobweb-1.1.0 lib/sidekiq/cobweb_helper.rb