Class: Flightdeck::QueueStats
- Inherits:
-
Object
- Object
- Flightdeck::QueueStats
- Defined in:
- app/models/flightdeck/queue_stats.rb
Overview
One row per queue, assembled from four grouped queries rather than the per-queue lookups SolidQueue::Queue#size / #latency would do — those are an N+1 as soon as an application has more than a handful of queues.
Pausing and resuming still go through SolidQueue::Queue, which owns the semantics; Flightdeck never writes to solid_queue_pauses itself.
Defined Under Namespace
Classes: Row
Constant Summary collapse
- RATE_WINDOW =
1.hour
Instance Method Summary collapse
Instance Method Details
#any_paused? ⇒ Boolean
50 |
# File 'app/models/flightdeck/queue_stats.rb', line 50 def any_paused? = rows.any?(&:paused?) |
#find(name) ⇒ Object
46 47 48 |
# File 'app/models/flightdeck/queue_stats.rb', line 46 def find(name) rows.find { |row| row.name == name } end |
#rows ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/models/flightdeck/queue_stats.rb', line 34 def rows @rows ||= names.sort.map do |name| Row.new( name: name, depth: depths.fetch(name, 0), oldest_ready_at: oldest_ready.fetch(name, nil), paused_at: pauses.fetch(name, nil), completed_in_window: completions.fetch(name, 0) ) end end |