1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Bloody hack to shutdown the Fetcher quickly, since Celluloid's terminate is not working as I expect

This commit is contained in:
Mike Perham 2012-05-11 21:25:38 -07:00
parent 1feebe7b51
commit 1d0f6b03dc
3 changed files with 15 additions and 0 deletions

View file

@ -1,6 +1,7 @@
1.2.1
-----------
- Fix issue with Fetcher slowing Sidekiq shutdown
- Print backtraces for all threads upon INFO signal [#183]
- Overhaul retries Web UI with new index page and bulk operations [#184]

View file

@ -28,6 +28,8 @@ module Sidekiq
# a new fetch if the current fetch turned up nothing.
def fetch
watchdog('Fetcher#fetch died') do
return if Sidekiq::Fetcher.done?
begin
queue = nil
msg = nil
@ -47,6 +49,17 @@ module Sidekiq
end
end
# Ugh. Say hello to a bloody hack.
# Can't find a clean way to get the fetcher to just stop processing
# its mailbox when shutdown starts.
def self.done!
@done = true
end
def self.done?
@done
end
private
# Creating the Redis#blpop command takes into account any

View file

@ -39,6 +39,7 @@ module Sidekiq
timeout = options[:timeout]
@done = true
Sidekiq::Fetcher.done!
@fetcher.terminate! if @fetcher.alive?
logger.info { "Shutting down #{@ready.size} quiet workers" }