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: "Arguments updated and job queued for retry."
rescue JSON::ParserError
  redirect_to failed_job_path(@execution), alert: "Invalid JSON — arguments were not saved."
rescue => e
  redirect_to failed_jobs_path, alert: "Could not update job: #{e.message}"
end