Sha256: f1937f22fd5c0a178d7f13e2ce76dd220c137259aa5789f9501bf7f554722fb6

Contents?: true

Size: 682 Bytes

Versions: 2

Compression:

Stored size: 682 Bytes

Contents

class MissionControl::Jobs::BulkDiscardsController < MissionControl::Jobs::ApplicationController
  include MissionControl::Jobs::FailedJobsBulkOperations

  def create
    jobs_to_discard_count = jobs_to_discard.count
    jobs_to_discard.discard_all

    redirect_to application_jobs_url(@application, :failed), notice: "Discarded #{jobs_to_discard_count} jobs"
  end

  private
    def jobs_to_discard
      if active_filters?
        bulk_limited_filtered_failed_jobs
      else
        # we don't want to apply any limit since "discarding all" without parameters can be optimized in the adapter as a much faster operation
        ApplicationJob.jobs.failed
      end
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mission_control-jobs-0.1.1 app/controllers/mission_control/jobs/bulk_discards_controller.rb
mission_control-jobs-0.1.0 app/controllers/mission_control/jobs/bulk_discards_controller.rb