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