module ActiveJob::Retriable

Constants

BASE_TAG
DEFAULT_FACTOR
DEFAULT_MAX
VERSION

Attributes

current_exception[RW]
retry_attempt[W]

Public Class Methods

print_exception_backtraces_to_stderr?() click to toggle source
print_exceptions_to_stderr=(option) click to toggle source
print_exceptions_to_stderr?() click to toggle source
reraise_when_retry_exhausted=(option) click to toggle source
# File lib/active_job/retriable.rb, line 16
def self.reraise_when_retry_exhausted=(option)
  @reraise_when_retry_exhausted = !!option
end
reraise_when_retry_exhausted?() click to toggle source
# File lib/active_job/retriable.rb, line 25
def self.reraise_when_retry_exhausted?
  @reraise_when_retry_exhausted
end

Public Instance Methods

deserialize(job_data) click to toggle source

Rails 5 deserialization approach NOTE the conditional will be removed with Rails 5

Calls superclass method
# File lib/active_job/retriable.rb, line 119
def deserialize(job_data)
  super job_data

  self.retry_attempt = job_data['retry_attempt']
end
retries_exhausted?() click to toggle source
# File lib/active_job/retriable.rb, line 101
def retries_exhausted?
  retry_attempt >= (self.class.retry_max || DEFAULT_MAX)
end
retry_attempt() click to toggle source
# File lib/active_job/retriable.rb, line 109
def retry_attempt
  @retry_attempt ||= 0
end
retry_delay() click to toggle source
# File lib/active_job/retriable.rb, line 105
def retry_delay
  (retry_attempt ** DEFAULT_FACTOR) + (rand(30) * retry_attempt)
end
serialize() click to toggle source
Calls superclass method
# File lib/active_job/retriable.rb, line 113
def serialize
  super.update 'retry_attempt' => retry_attempt
end