Module: Sidekiq::ThrottledWorker

Defined in:
lib/sidekiq/throttled_worker.rb,
lib/sidekiq/throttled_worker/fetch.rb,
lib/sidekiq/throttled_worker/version.rb,
lib/sidekiq/throttled_worker/middleware.rb,
lib/sidekiq/throttled_worker/concurrency.rb

Defined Under Namespace

Modules: Concurrency Classes: Error, Fetch, Middleware

Constant Summary collapse

VERSION =
"0.1.3"

Class Method Summary collapse

Class Method Details

.redisObject



28
29
30
# File 'lib/sidekiq/throttled_worker.rb', line 28

def redis
  @redis ||= Sidekiq.redis_pool
end

.redis=(hash) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/sidekiq/throttled_worker.rb', line 20

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

.setup!Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/sidekiq/throttled_worker.rb', line 7

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