Class: SidekiqVigil::Check::ScheduledBacklog

Inherits:
Base
  • Object
show all
Defined in:
lib/sidekiq_vigil/check/scheduled_backlog.rb

Instance Attribute Summary

Attributes inherited from Base

#api, #clock, #logger, #options, #storage

Instance Method Summary collapse

Methods inherited from Base

#check_name, #execute, #initialize

Constructor Details

This class inherits a constructor from SidekiqVigil::Check::Base

Instance Method Details

#callObject



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/sidekiq_vigil/check/scheduled_backlog.rb', line 6

def call
  overdue_count = api.scheduled.count do |job|
    timestamp = job.respond_to?(:at) ? job.at : Time.at(job.score.to_f)
    timestamp <= clock.call - options.fetch(:overdue, 300)
  end
  threshold_result(
    target: "global",
    value: overdue_count,
    warn: options.fetch(:warn, 1),
    critical: options.fetch(:critical, 100),
    message: "#{overdue_count} overdue scheduled jobs"
  )
end