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

This reverts commit c3497559be71598f1ae06677c0225bb4322e1688.
This commit is contained in:
David Taylor
2019-08-30 11:26:16 +01:00
parent 5d4fcc62bb
commit e2449f9f23
6 changed files with 34 additions and 76 deletions

View File

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

View File

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