Class: SolidQueueGuard::Checks::Runtime::FinishedJobsGrowthCheck

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

Constant Summary collapse

WINDOW =
24.hours
GROWTH_THRESHOLD =
10_000

Instance Method Summary collapse

Instance Method Details

#callObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/solid_queue_guard/checks/runtime/finished_jobs_growth_check.rb', line 10

def call
  with_queue_database do
    recent_finished = SolidQueue::Job.where(finished_at: WINDOW.ago..).count

    if recent_finished > GROWTH_THRESHOLD
      warn(
        check_id,
        "#{recent_finished} finished jobs in the last 24 hours",
        suggestion: 'Ensure a recurring cleanup task runs (SolidQueue::Job.clear_finished_in_batches)'
      )
    else
      pass(check_id, "#{recent_finished} finished jobs in the last 24 hours")
    end
  end
end