Class: SolidQueueWeb::FailedJobs::SelectionsController

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

Constant Summary

Constants inherited from ApplicationController

ApplicationController::PERIOD_DURATIONS, ApplicationController::STAGGER_INTERVALS

Instance Method Summary collapse

Instance Method Details

#createObject



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

def create
  ids = Array(params[:ids]).map(&:to_i).reject(&:zero?)
  executions = SolidQueue::FailedExecution.where(id: ids)
  jobs = executions.includes(:job).map(&:job)
  SolidQueue::FailedExecution.retry_all(jobs)
  record_audit("failed_jobs_retried", item_count: jobs.size)
  redirect_to failed_jobs_path,
    notice: t("solid_queue_web.flash.jobs_retried", count: jobs.size)
rescue => e
  redirect_to failed_jobs_path, alert: t("solid_queue_web.flash.cannot_retry_jobs", error: e.message)
end

#destroyObject



16
17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/solid_queue_web/failed_jobs/selections_controller.rb', line 16

def destroy
  ids = Array(params[:ids]).map(&:to_i).reject(&:zero?)
  executions = SolidQueue::FailedExecution.where(id: ids)
  jobs = executions.includes(:job).map(&:job)
  SolidQueue::FailedExecution.discard_all_from_jobs(jobs)
  record_audit("failed_jobs_discarded", item_count: jobs.size)
  redirect_to failed_jobs_path,
    notice: t("solid_queue_web.flash.jobs_discarded", count: jobs.size)
rescue => e
  redirect_to failed_jobs_path, alert: t("solid_queue_web.flash.cannot_discard_jobs", error: e.message)
end