lib/good_job/active_job_job.rb
# Retry a job that has errored and been discarded.
# This action will create a new {Execution} record for the job.
# @return [ActiveJob::Base]
Retry a job that has errored and been discarded.
This action will create a new {Execution} record for the job.
Retry a job that has errored and been discarded . This action will create a new { Execution } record for the job .
def retry_job
      with_advisory_lock do
        execution = head_execution(reload: true)
        active_job = execution.active_job
        raise AdapterNotGoodJobError unless active_job.class.queue_adapter.is_a? GoodJob::Adapter
        raise ActionForStateMismatchError if execution.finished_at.blank? || execution.error.blank?
        active_job.executions = (active_job.executions || 0) + 1
        new_active_job = nil
        GoodJob::CurrentThread.within do |current_thread|
          current_thread.execution = execution
          execution.class.transaction(joinable: false, requires_new: true) do
            new_active_job = active_job.retry_job(wait: 0, error: execution.error)
            execution.save
          end
        end
        new_active_job
      end
    end
def retry_job with_advisory_lock do execution = head_execution ( reload : true ) active_job = execution . active_job raise AdapterNotGoodJobError unless active_job . class . queue_adapter . is_a? GoodJob :: Adapter raise ActionForStateMismatchError if execution . finished_at . blank? || execution . error . blank? active_job . executions = ( active_job . executions || 0 ) + 1 new_active_job = nil GoodJob :: CurrentThread . within do | current_thread | current_thread . execution = execution execution . class . transaction ( joinable : false , requires_new : true ) do new_active_job = active_job . retry_job ( wait : 0 , error : execution . error ) execution . save end end new_active_job end end
Retry a job that has errored and been discarded.
Retry a job that has errored and been discarded .
# Update the executions count because the previous execution will not have been preserved # Do not update `exception_executions` because that comes from rescue_from's arguments
None
ActiveJob::Base