Class: JobBoard::Throughput

Inherits:
Object
  • Object
show all
Defined in:
app/models/job_board/throughput.rb

Constant Summary collapse

READY_AT =
"COALESCE(scheduled_at, created_at)".freeze

Class Method Summary collapse

Class Method Details

.snapshot(since:) ⇒ Object



6
7
8
9
10
11
12
13
# File 'app/models/job_board/throughput.rb', line 6

def snapshot(since:)
  now = Time.current
  {
    now: now.iso8601(3),
    enqueued: since ? count_between(READY_AT, since, now) : 0,
    completed: since ? count_between("finished_at", since, now) : 0
  }
end