Revert "Revert "FIX: Heartbeat check per sidekiq process (#7873)""

This reverts commit e805d44965.
We now have mechanisms in place to ensure heartbeat will always
be scheduled even if the scheduler is overloaded per: 098f938b
This commit is contained in:
Sam Saffron
2019-08-30 10:12:10 +10:00
parent ff8cc244d8
commit c3497559be
6 changed files with 76 additions and 34 deletions

View File

@@ -2,19 +2,8 @@
module Jobs
class RunHeartbeat < Jobs::Base
sidekiq_options queue: 'critical'
def self.heartbeat_key
'heartbeat_last_run'
end
def execute(args)
$redis.set(self.class.heartbeat_key, Time.new.to_i.to_s)
end
def self.last_heartbeat
$redis.get(heartbeat_key).to_i
Demon::Sidekiq.trigger_heartbeat(args[:queue_name])
end
end
end

View File

@@ -7,7 +7,9 @@ module Jobs
every 3.minute
def execute(args)
Jobs.enqueue(:run_heartbeat, {})
Demon::Sidekiq::QUEUE_IDS.each do |identifier|
Jobs.enqueue(:run_heartbeat, queue_name: identifier, queue: identifier)
end
end
end
end