Module: GoodJob::CurrentExecution

Defined in:
lib/good_job/current_execution.rb

Overview

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

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.error_on_discardException?

Error captured by discard_on

Returns:

  • (Exception, nil)


18
# File 'lib/good_job/current_execution.rb', line 18

thread_mattr_accessor :error_on_discard

.error_on_retryException?

Error captured by retry_on

Returns:

  • (Exception, nil)


12
# File 'lib/good_job/current_execution.rb', line 12

thread_mattr_accessor :error_on_retry

Class Method Details

.process_idInteger

Returns Current process ID.

Returns:

  • (Integer)

    Current process ID



28
29
30
# File 'lib/good_job/current_execution.rb', line 28

def self.process_id
  Process.pid
end

.resetvoid

This method returns an undefined value.

Resets attributes



22
23
24
25
# File 'lib/good_job/current_execution.rb', line 22

def self.reset
  self.error_on_retry = nil
  self.error_on_discard = nil
end

.thread_nameString

Returns Current thread name.

Returns:

  • (String)

    Current thread name



33
34
35
# File 'lib/good_job/current_execution.rb', line 33

def self.thread_name
  (Thread.current.name || Thread.current.object_id).to_s
end