Class: SolidQueueWeb::PerformanceController

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

Constant Summary

Constants inherited from ApplicationController

ApplicationController::PERIOD_DURATIONS, ApplicationController::STAGGER_INTERVALS

Instance Method Summary collapse

Instance Method Details

#indexObject



3
4
5
6
7
8
9
10
# File 'app/controllers/solid_queue_web/performance_controller.rb', line 3

def index
  @period = params[:period].presence_in(PERIOD_DURATIONS.keys)

  scope = SolidQueue::Job.where.not(finished_at: nil)
  scope = scope.where("finished_at >= ?", PERIOD_DURATIONS[@period].ago) if @period.present?

  @rows = JobPerformanceStats.new(scope).rows
end