mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
More actor safety checks, #53
This commit is contained in:
parent
0a23209237
commit
7d86d834fe
1 changed files with 7 additions and 3 deletions
|
@ -35,7 +35,7 @@ module Sidekiq
|
|||
timeout = options[:timeout]
|
||||
|
||||
@done = true
|
||||
@ready.each(&:terminate)
|
||||
@ready.each { |x| x.terminate if x.alive? }
|
||||
@ready.clear
|
||||
|
||||
redis.with_connection do |conn|
|
||||
|
@ -54,7 +54,7 @@ module Sidekiq
|
|||
end
|
||||
|
||||
after(timeout) do
|
||||
@busy.each(&:terminate)
|
||||
@busy.each { |x| x.terminate if x.alive? }
|
||||
signal(:shutdown)
|
||||
end
|
||||
end
|
||||
|
@ -76,7 +76,7 @@ module Sidekiq
|
|||
processor.terminate if processor.alive?
|
||||
signal(:shutdown) if @busy.empty?
|
||||
else
|
||||
@ready << processor
|
||||
@ready << processor if processor.alive?
|
||||
end
|
||||
dispatch
|
||||
end
|
||||
|
@ -109,6 +109,10 @@ module Sidekiq
|
|||
watchdog("Fatal error in sidekiq, dispatch loop died") do
|
||||
return if stopped?
|
||||
|
||||
# This is a safety check to ensure we haven't leaked
|
||||
# processors somehow.
|
||||
raise "BUG: No processors, cannot continue!" if @ready.empty? && @busy.empty?
|
||||
|
||||
# Dispatch loop
|
||||
loop do
|
||||
break logger.debug('no processors') if @ready.empty?
|
||||
|
|
Loading…
Reference in a new issue