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
13
# 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)
  record_audit("failed_jobs_retried", item_count: count)
  redirect_to failed_jobs_path, notice: t("solid_stack_web.flash.jobs_retried", count: count)
rescue => e
  redirect_to failed_jobs_path, alert: t("solid_stack_web.flash.cannot_retry_jobs", error: e.message)
end

#destroyObject



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

def destroy
  job_ids = SolidQueue::FailedExecution.where(id: @ids).pluck(:job_id)
  count = SolidQueue::Job.where(id: job_ids).destroy_all.size
  record_audit("failed_jobs_discarded", item_count: count)
  redirect_to failed_jobs_path, notice: t("solid_stack_web.flash.jobs_discarded", count: count)
rescue => e
  redirect_to failed_jobs_path, alert: t("solid_stack_web.flash.cannot_discard_jobs", error: e.message)
end