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



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

def create
  count = @ids.size
  SolidQueue::FailedExecution.where(id: @ids).each(&:retry)
  redirect_to failed_jobs_path, notice: "#{count} #{count == 1 ? "job" : "jobs"} retried."
rescue => e
  redirect_to failed_jobs_path, alert: "Could not retry jobs: #{e.message}"
end

#destroyObject



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

def destroy
  job_ids = SolidQueue::FailedExecution.where(id: @ids).pluck(:job_id)
  count = SolidQueue::Job.where(id: job_ids).destroy_all.size
  redirect_to failed_jobs_path, notice: "#{count} #{count == 1 ? "job" : "jobs"} discarded."
rescue => e
  redirect_to failed_jobs_path, alert: "Could not discard jobs: #{e.message}"
end