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

Instance Method Details

#deregister_processObject

Deregisters the current process.



34
35
36
37
38
# File 'lib/good_job/notifier/process_heartbeat.rb', line 34

def deregister_process
  GoodJob::Process.override_connection(connection) do
    @capsule.tracker.unregister(with_advisory_lock: true)
  end
end

#refresh_processObject



23
24
25
26
27
28
29
30
31
# File 'lib/good_job/notifier/process_heartbeat.rb', line 23

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_processObject

Registers the current process.



16
17
18
19
20
21
# File 'lib/good_job/notifier/process_heartbeat.rb', line 16

def register_process
  GoodJob::Process.override_connection(connection) do
    GoodJob::Process.cleanup
    @capsule.tracker.register(with_advisory_lock: true)
  end
end