Module: GoodJob::Notifier::ProcessHeartbeat
- Extended by:
- ActiveSupport::Concern
- Included in:
- GoodJob::Notifier
- Defined in:
- lib/good_job/notifier/process_heartbeat.rb
Overview
Extends the Notifier to register the process in the database.
Instance Method Summary collapse
-
#deregister_process ⇒ Object
Deregisters the current process.
- #refresh_process ⇒ Object
-
#register_process ⇒ Object
Registers the current process.
Instance Method Details
#deregister_process ⇒ Object
Deregisters the current process.
35 36 37 38 39 |
# File 'lib/good_job/notifier/process_heartbeat.rb', line 35 def deregister_process GoodJob::Process.override_connection(connection) do @capsule.tracker.unregister(with_advisory_lock: @advisory_lock_heartbeat) end end |
#refresh_process ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/good_job/notifier/process_heartbeat.rb', line 24 def refresh_process Rails.application.executor.wrap do GoodJob::Process.override_connection(connection) do GoodJob::Process.with_logger_silenced do @capsule.tracker.renew end end end end |
#register_process ⇒ Object
Registers the current process.
16 17 18 19 20 21 22 |
# File 'lib/good_job/notifier/process_heartbeat.rb', line 16 def register_process @advisory_lock_heartbeat = GoodJob.configuration.advisory_lock_heartbeat GoodJob::Process.override_connection(connection) do GoodJob::Process.cleanup @capsule.tracker.register(with_advisory_lock: @advisory_lock_heartbeat) end end |