Class: SolidStackWeb::FailedJobs::ArgumentsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/solid_stack_web/failed_jobs/arguments_controller.rb

Constant Summary

Constants inherited from ApplicationController

ApplicationController::PERIOD_DURATIONS

Instance Method Summary collapse

Instance Method Details

#updateObject



4
5
6
7
8
9
10
11
12
13
14
# File 'app/controllers/solid_stack_web/failed_jobs/arguments_controller.rb', line 4

def update
  @execution = SolidQueue::FailedExecution.includes(:job).find(params[:failed_job_id])
  new_arguments = JSON.parse(params[:arguments])
  @execution.job.update!(arguments: new_arguments)
  @execution.retry
  redirect_to failed_jobs_path, notice: t("solid_stack_web.flash.arguments_updated")
rescue JSON::ParserError
  redirect_to failed_job_path(@execution), alert: t("solid_stack_web.flash.invalid_json")
rescue => e
  redirect_to failed_jobs_path, alert: t("solid_stack_web.flash.cannot_update_job", error: e.message)
end