Class: Barbeque::JobExecutionsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/barbeque/job_executions_controller.rb

Constant Summary collapse

ID_REGEXP =
/\A[0-9]+\z/

Instance Method Summary collapse

Instance Method Details

#retryObject

Raises:

  • (ActionController::BadRequest)


17
18
19
20
21
22
23
24
25
# File 'app/controllers/barbeque/job_executions_controller.rb', line 17

def retry
  @job_execution = Barbeque::JobExecution.find_by!(message_id: params[:job_execution_message_id])
  raise ActionController::BadRequest unless @job_execution.retryable?

  result = Barbeque::MessageRetryingService.new(message_id: @job_execution.message_id).run
  @job_execution.retried!

  redirect_to @job_execution, notice: "Succeed to retry (message_id=#{result.message_id})"
end

#showObject



4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/barbeque/job_executions_controller.rb', line 4

def show
  if ID_REGEXP === params[:message_id]
    job_execution = Barbeque::JobExecution.find_by(id: params[:message_id])
    if job_execution
      redirect_to(job_execution)
      return
    end
  end
  @job_execution = Barbeque::JobExecution.find_by!(message_id: params[:message_id])
  @log = @job_execution.execution_log
  @job_retries = @job_execution.job_retries.order(id: :desc)
end