Sha256: 104dba61e550a7c8623319334f16897dddd48d31e5058b2d647fa17603343cfa
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 KB
Contents
# frozen_string_literal: true module GoodJob # :nodoc: class Notifier # :nodoc: # Extends the Notifier to register the process in the database. module ProcessHeartbeat extend ActiveSupport::Concern included do set_callback :listen, :after, :register_process set_callback :tick, :before, :refresh_process set_callback :unlisten, :after, :deregister_process end # Registers the current process. def register_process GoodJob::Process.with_connection(connection) do GoodJob::Process.cleanup @process = GoodJob::Process.register end end def refresh_process GoodJob::Process.with_connection(connection) do Process.logger.silence do @process&.refresh_if_stale(cleanup: true) end end end # Deregisters the current process. def deregister_process GoodJob::Process.with_connection(connection) do @process&.deregister end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
good_job-3.16.0 | lib/good_job/notifier/process_heartbeat.rb |
good_job-3.15.14 | lib/good_job/notifier/process_heartbeat.rb |