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