diff --git a/lib/sidekiq/fetch.rb b/lib/sidekiq/fetch.rb index 12020767..f0169ec2 100644 --- a/lib/sidekiq/fetch.rb +++ b/lib/sidekiq/fetch.rb @@ -30,15 +30,16 @@ module Sidekiq # a new fetch if the current fetch turned up nothing. def fetch watchdog('Fetcher#fetch died') do - + queue = nil msg = nil - Sidekiq.redis do |conn| - (queue, msg) = conn.blpop *@cmd - puts 'All quiet' unless msg - @mgr.assign! msg, queue.gsub(/\Aqueue:/, '') if msg - end - after(0) { fetch } if !msg + Sidekiq.redis { |conn| (queue, msg) = conn.blpop(*@cmd) } + if msg + @mgr.assign!(msg, queue.gsub(/\Aqueue:/, '')) + else + puts 'All quiet' + after(0) { fetch } + end end end diff --git a/lib/sidekiq/manager.rb b/lib/sidekiq/manager.rb index 76ff29f3..dd0399b2 100644 --- a/lib/sidekiq/manager.rb +++ b/lib/sidekiq/manager.rb @@ -40,8 +40,8 @@ module Sidekiq @done = true - @fetcher.terminate if @fetcher.alive? - @ready.each { |x| x.terminate if x.alive? } + @fetcher.terminate! if @fetcher.alive? + @ready.each { |x| x.terminate! if x.alive? } @ready.clear redis do |conn|