Class: SolidQueueWeb::DashboardController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- SolidQueueWeb::DashboardController
- Defined in:
- app/controllers/solid_queue_web/dashboard_controller.rb
Constant Summary
Constants inherited from ApplicationController
ApplicationController::PERIOD_DURATIONS
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/solid_queue_web/dashboard_controller.rb', line 3 def index @stats = { ready: SolidQueue::ReadyExecution.count, scheduled: SolidQueue::ScheduledExecution.count, claimed: SolidQueue::ClaimedExecution.count, failed: SolidQueue::FailedExecution.count, blocked: SolidQueue::BlockedExecution.count, queues: SolidQueue::Job.select(:queue_name).distinct.count, processes: SolidQueue::Process.count, recurring: SolidQueue::RecurringTask.count } now = Time.current finished_times = SolidQueue::Job.where(finished_at: 24.hours.ago..now).pluck(:finished_at) @throughput = { completed_1h: finished_times.count { |t| t >= 1.hour.ago }, completed_24h: finished_times.size } @sparkline = 12.times.map do |i| from = (12 - i).hours.ago to = i == 11 ? now : (11 - i).hours.ago finished_times.count { |t| t >= from && t < to } end end |