Class: SolidStackWeb::FailedJobs::SelectionsController

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

Constant Summary

Constants inherited from ApplicationController

ApplicationController::PERIOD_DURATIONS

Instance Method Summary collapse

Instance Method Details

#createObject



4
5
6
7
8
9
10
# File 'app/controllers/solid_stack_web/failed_jobs/selections_controller.rb', line 4

def create
  ids = Array(params[:job_ids]).map(&:to_i).reject(&:zero?)
  SolidQueue::FailedExecution.where(id: ids).each(&:retry)
  redirect_to failed_jobs_path
rescue => e
  redirect_to failed_jobs_path, alert: "Could not retry jobs: #{e.message}"
end

#destroyObject



12
13
14
15
16
17
18
19
# File 'app/controllers/solid_stack_web/failed_jobs/selections_controller.rb', line 12

def destroy
  ids     = Array(params[:job_ids]).map(&:to_i).reject(&:zero?)
  job_ids = SolidQueue::FailedExecution.where(id: ids).pluck(:job_id)
  SolidQueue::Job.where(id: job_ids).destroy_all
  redirect_to failed_jobs_path
rescue => e
  redirect_to failed_jobs_path, alert: "Could not discard jobs: #{e.message}"
end