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