Permalink
Browse files

polish

  • Loading branch information...
1 parent 62b9125 commit 96d6c715732cefb405c7327f90e8517dc4529064 @mperham committed Apr 8, 2012
Showing with 6 additions and 5 deletions.
  1. +3 −1 lib/sidekiq/cli.rb
  2. +3 −4 lib/sidekiq/manager.rb
View
@@ -64,9 +64,11 @@ def run
sleep
rescue Interrupt
logger.info 'Shutting down'
- poller.terminate
+ poller.terminate if poller.alive?
@manager.stop!(:shutdown => true, :timeout => options[:timeout])
@manager.wait(:shutdown)
+ # Explicitly exit so busy Processor threads can't block
+ # process shutdown.
exit(0)
end
end
View
@@ -38,7 +38,6 @@ def stop(options={})
timeout = options[:timeout]
@done = true
-
@fetcher.terminate if @fetcher.alive?
logger.info { "Shutting down #{@ready.size} quiet workers" }
@@ -55,7 +54,7 @@ def stop(options={})
return after(0) { signal(:shutdown) } if @busy.empty?
logger.info { "Pausing up to #{timeout} seconds to allow workers to finish..." }
- hard_shutdown_in(timeout) if shutdown
+ hard_shutdown_in timeout if shutdown
end
end
@@ -108,8 +107,8 @@ def assign(msg, queue)
private
def hard_shutdown_in(delay)
- watchdog("Manager#watch_for_shutdown died") do
- after(delay) do
+ after(delay) do
+ watchdog("Manager#watch_for_shutdown died") do
# We've reached the timeout and we still have busy workers.
# They must die but their messages shall live on.
logger.info("Still waiting for #{@busy.size} busy workers")

0 comments on commit 96d6c71

Please sign in to comment.