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
|
1.2.1
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
|
- Fix issue with Fetcher slowing Sidekiq shutdown
|
||||||
- Print backtraces for all threads upon INFO signal [#183]
|
- Print backtraces for all threads upon INFO signal [#183]
|
||||||
- Overhaul retries Web UI with new index page and bulk operations [#184]
|
- 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.
|
# a new fetch if the current fetch turned up nothing.
|
||||||
def fetch
|
def fetch
|
||||||
watchdog('Fetcher#fetch died') do
|
watchdog('Fetcher#fetch died') do
|
||||||
|
return if Sidekiq::Fetcher.done?
|
||||||
|
|
||||||
begin
|
begin
|
||||||
queue = nil
|
queue = nil
|
||||||
msg = nil
|
msg = nil
|
||||||
|
@ -47,6 +49,17 @@ module Sidekiq
|
||||||
end
|
end
|
||||||
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
|
private
|
||||||
|
|
||||||
# Creating the Redis#blpop command takes into account any
|
# Creating the Redis#blpop command takes into account any
|
||||||
|
|
|
@ -39,6 +39,7 @@ module Sidekiq
|
||||||
timeout = options[:timeout]
|
timeout = options[:timeout]
|
||||||
|
|
||||||
@done = true
|
@done = true
|
||||||
|
Sidekiq::Fetcher.done!
|
||||||
@fetcher.terminate! if @fetcher.alive?
|
@fetcher.terminate! if @fetcher.alive?
|
||||||
|
|
||||||
logger.info { "Shutting down #{@ready.size} quiet workers" }
|
logger.info { "Shutting down #{@ready.size} quiet workers" }
|
||||||
|
|
Loading…
Reference in a new issue