Skip to content

Commit

Permalink
Terminate fetcher async'ly so it doesn't block shutdown progress
Browse files Browse the repository at this point in the history
  • Loading branch information
mperham committed Apr 25, 2012
1 parent c282674 commit 06b6aa4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/sidekiq/manager.rb
Expand Up @@ -39,7 +39,7 @@ def stop(options={})
timeout = options[:timeout]

@done = true
@fetcher.terminate if @fetcher.alive?
@fetcher.terminate! if @fetcher.alive?

logger.info { "Shutting down #{@ready.size} quiet workers" }
@ready.each { |x| x.terminate if x.alive? }
Expand Down
7 changes: 7 additions & 0 deletions test/test_manager.rb
Expand Up @@ -38,6 +38,13 @@ def perform(a, b)
result = q.timed_pop(1.0)
assert_equal 'done', result
mgr.stop
mgr.terminate

# Gross bloody hack because I can't get the actor threads
# to shut down cleanly in the test. Need @bascule's help here.
(Thread.list - [Thread.current]).each do |t|
t.raise Interrupt
end
end
end
end

0 comments on commit 06b6aa4

Please sign in to comment.