lib/sidekiq/limit_fetch/local/selector.rb in sidekiq-limit_fetch-0.7 vs lib/sidekiq/limit_fetch/local/selector.rb in sidekiq-limit_fetch-0.8
- old
+ new
@@ -1,10 +1,15 @@
module Sidekiq::LimitFetch::Local
module Selector
extend self
def acquire(names)
- queues(names).select(&:acquire).map(&:name)
+ 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
def release(names)
queues(names).each(&:release)
end