Class: SolidStackWeb::FailedJobsController

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

Constant Summary

Constants inherited from ApplicationController

ApplicationController::PERIOD_DURATIONS

Instance Method Summary collapse

Instance Method Details

#destroyObject



24
25
26
27
28
29
30
31
32
33
# File 'app/controllers/solid_stack_web/failed_jobs_controller.rb', line 24

def destroy
  @execution = ::SolidQueue::FailedExecution.find(params[:id])
  @execution.job.destroy!
  @executions_remain = ::SolidQueue::FailedExecution.exists?

  respond_to do |format|
    format.html { redirect_to failed_jobs_path }
    format.turbo_stream
  end
end

#indexObject



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/solid_stack_web/failed_jobs_controller.rb', line 3

def index
  respond_to do |format|
    format.html do
      scope = ::SolidQueue::FailedExecution.includes(:job).order(created_at: :desc)
      @pagy, @executions = pagy(scope)
    end
    format.csv do
      send_data failed_jobs_csv,
                filename: "failed-jobs-#{Date.today}.csv",
                type: "text/csv", disposition: "attachment"
    end
  end
end

#retryObject



35
36
37
38
39
# File 'app/controllers/solid_stack_web/failed_jobs_controller.rb', line 35

def retry
  execution = ::SolidQueue::FailedExecution.find(params[:id])
  execution.retry
  redirect_to failed_jobs_path
end

#showObject



17
18
19
20
21
22
# File 'app/controllers/solid_stack_web/failed_jobs_controller.rb', line 17

def show
  @execution = ::SolidQueue::FailedExecution.includes(:job).find(params[:id])
  @arguments = JSON.pretty_generate(@execution.job.arguments) if @execution.job.arguments.present?
rescue JSON::GeneratorError
  @arguments = @execution.job.arguments.to_s
end