Module: Sidekiq::Ultimate::Resurrector
- Defined in:
- lib/sidekiq/ultimate/resurrector.rb,
lib/sidekiq/ultimate/resurrector/lock.rb,
lib/sidekiq/ultimate/resurrector/count.rb,
lib/sidekiq/ultimate/resurrector/common_constants.rb,
lib/sidekiq/ultimate/resurrector/resurrection_script.rb
Overview
Lost jobs checker and resurrector
Defined Under Namespace
Modules: CommonConstants, Count Classes: Lock, ResurrectionScript
Constant Summary collapse
- ResurrectorTimerTask =
Class.new(Concurrent::TimerTask)
- HeartbeatTimerTask =
Class.new(Concurrent::TimerTask)
Class Method Summary collapse
- .current_process_identity ⇒ Object
-
.resurrect! ⇒ Object
go over all sidekiq processes (identities) that were shut down recently, get all their queues and try to resurrect them.
- .setup! ⇒ Object
Class Method Details
.current_process_identity ⇒ Object
49 50 51 |
# File 'lib/sidekiq/ultimate/resurrector.rb', line 49 def current_process_identity @current_process_identity ||= Object.new.tap { |o| o.extend Sidekiq::Component }.identity end |
.resurrect! ⇒ Object
go over all sidekiq processes (identities) that were shut down recently, get all their queues and try to resurrect them
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/sidekiq/ultimate/resurrector.rb', line 35 def resurrect! Sidekiq::Ultimate::Resurrector::Lock.acquire do casualties.each do |identity| log(:debug) { "Resurrecting #{identity}" } queues = queues_of(identity).each { |queue| resurrect(queue) } cleanup(identity, queues.map(&:inproc)) end end rescue => e log(:error) { "Resurrection failed: #{e}" } raise end |
.setup! ⇒ Object
28 29 30 31 |
# File 'lib/sidekiq/ultimate/resurrector.rb', line 28 def setup! register_process_heartbeat register_resurrector end |