2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2014-04-22 23:13:18 -04:00
|
|
|
module Jobs
|
|
|
|
class RunHeartbeat < Jobs::Base
|
|
|
|
|
2016-04-06 22:56:43 -04:00
|
|
|
sidekiq_options queue: 'critical'
|
|
|
|
|
2014-04-22 23:13:18 -04:00
|
|
|
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
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|