Sha256: 82d75799c9af46af911dbe3c98fa71d2eb9692ff1c7b71ec71b975465386d614

Contents?: true

Size: 863 Bytes

Versions: 1

Compression:

Stored size: 863 Bytes

Contents

require 'sidekiq/throttled_worker/version'

module Sidekiq
  module ThrottledWorker
    class Error < StandardError; end
    class << self
      def setup!
        Sidekiq.configure_server do |config|
          require 'sidekiq/throttled_worker/fetch'
          require 'sidekiq/throttled_worker/middleware'
          require 'sidekiq/throttled_worker/concurrency'

          Sidekiq.options[:fetch] = Sidekiq::ThrottledWorker::Fetch
          config.server_middleware do |chain|
            chain.add Sidekiq::ThrottledWorker::Middleware
          end
        end
      end

      def redis=(hash)
        @redis = if hash.is_a?(ConnectionPool)
                   hash
                 else
                   Sidekiq::RedisConnection.create(hash)
                 end
      end

      def redis
        @redis ||= Sidekiq.redis_pool
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sidekiq-throttled-worker-0.1.3 lib/sidekiq/throttled_worker.rb