module GoodJob::CurrentExecution

Thread-local attributes for passing values from Instrumentation. (Cannot use ActiveSupport::CurrentAttributes because ActiveJob resets it)

Public Class Methods

active_job_id() click to toggle source

@return [String] UUID of the currently executing GoodJob::Job

   # File lib/good_job/current_execution.rb
42 def self.active_job_id
43   good_job&.active_job_id
44 end
process_id() click to toggle source

@return [Integer] Current process ID

   # File lib/good_job/current_execution.rb
47 def self.process_id
48   Process.pid
49 end
reset() click to toggle source

Resets attributes @return [void]

   # File lib/good_job/current_execution.rb
34 def self.reset
35   self.cron_key = nil
36   self.good_job = nil
37   self.error_on_discard = nil
38   self.error_on_retry = nil
39 end
thread_name() click to toggle source

@return [String] Current thread name

   # File lib/good_job/current_execution.rb
52 def self.thread_name
53   (Thread.current.name || Thread.current.object_id).to_s
54 end