Class: Barbeque::JobExecution

Inherits:
ApplicationRecord show all
Defined in:
app/models/barbeque/job_execution.rb

Direct Known Subclasses

MessageHandler::Notification

Instance Method Summary collapse

Instance Method Details

#execution_logHash

Returns - A hash created by ‘JobExecutor::Job#log_result`.

Returns:

  • (Hash)
    • A hash created by ‘JobExecutor::Job#log_result`



20
21
22
# File 'app/models/barbeque/job_execution.rb', line 20

def execution_log
  @execution_log ||= Barbeque::ExecutionLog.load(execution: self)
end

#retry_if_possible!Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'app/models/barbeque/job_execution.rb', line 32

def retry_if_possible!
  unless retryable?
    return
  end
  retry_config = job_definition.retry_config
  unless retry_config
    return
  end

  retries = job_retries.count
  if retry_config.should_retry?(retries)
    delay_seconds = retry_config.delay_seconds(retries).to_i
    Barbeque::MessageRetryingService.new(message_id: message_id, delay_seconds: delay_seconds).run
    retried!
  end
end

#retryable?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'app/models/barbeque/job_execution.rb', line 24

def retryable?
  failed? || error?
end

#to_paramObject



28
29
30
# File 'app/models/barbeque/job_execution.rb', line 28

def to_param
  message_id
end