Module: Sidekiq::LimitFetch::Local::Selector

Extended by:
Selector
Included in:
Selector
Defined in:
lib/sidekiq/limit_fetch/local/selector.rb

Instance Method Summary collapse

Instance Method Details

#acquire(names) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/sidekiq/limit_fetch/local/selector.rb', line 5

def acquire(names)
  blocked = false
  queues(names).select {|queue|
    next false      if blocked
    blocked = true  if not queue.paused? and queue.blocking? and queue.busy > 0
    queue.acquire
  }.map(&:name)
end

#release(names) ⇒ Object



14
15
16
# File 'lib/sidekiq/limit_fetch/local/selector.rb', line 14

def release(names)
  queues(names).each(&:release)
end