Class: SolidQueueGuard::Checks::Runtime::ScheduledBacklogCheck

Inherits:
Base
  • Object
show all
Defined in:
lib/solid_queue_guard/checks/runtime/scheduled_backlog_check.rb

Instance Method Summary collapse

Instance Method Details

#callObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/solid_queue_guard/checks/runtime/scheduled_backlog_check.rb', line 7

def call
  with_queue_database do
    due_count = SolidQueue::ScheduledExecution.due.count
    threshold = config.scheduled_backlog_threshold

    if due_count > threshold
      warn(
        check_id,
        "Scheduled backlog is #{due_count} (threshold: #{threshold})",
        suggestion: 'Check dispatcher health and scheduled job volume'
      )
    else
      pass(check_id, "Scheduled backlog is #{due_count}")
    end
  end
end