discourse/app/jobs/regular/run_heartbeat.rb
Joffrey JAFFEUX 0d3d2c43a0
DEV: s/\$redis/Discourse\.redis (#8431)
This commit also adds a rubocop rule to prevent global variables.
2019-12-03 10:05:53 +01:00

21 lines
377 B
Ruby

# frozen_string_literal: true
module Jobs
class RunHeartbeat < ::Jobs::Base
sidekiq_options queue: 'critical'
def self.heartbeat_key
'heartbeat_last_run'
end
def execute(args)
Discourse.redis.set(self.class.heartbeat_key, Time.new.to_i.to_s)
end
def self.last_heartbeat
Discourse.redis.get(heartbeat_key).to_i
end
end
end