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:
parent
1feebe7b51
commit
1d0f6b03dc
3 changed files with 15 additions and 0 deletions
|
@ -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]
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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" }
|
||||
|
|
Loading…
Reference in a new issue