2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2014-04-22 23:13:18 -04:00
|
|
|
module Jobs
|
2019-10-02 00:01:53 -04:00
|
|
|
class RunHeartbeat < ::Jobs::Base
|
2019-08-30 06:26:16 -04:00
|
|
|
|
|
|
|
sidekiq_options queue: 'critical'
|
|
|
|
|
|
|
|
def self.heartbeat_key
|
|
|
|
'heartbeat_last_run'
|
|
|
|
end
|
|
|
|
|
2014-04-22 23:13:18 -04:00
|
|
|
def execute(args)
|
2019-08-30 06:26:16 -04:00
|
|
|
$redis.set(self.class.heartbeat_key, Time.new.to_i.to_s)
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.last_heartbeat
|
|
|
|
$redis.get(heartbeat_key).to_i
|
2014-04-22 23:13:18 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|