7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/solid_queue_guard/checks/runtime/recurring_stale_check.rb', line 7
def call
with_queue_database do
tasks = SolidQueue::RecurringTask.static
return pass(check_id, 'No recurring tasks configured') if tasks.none?
stale_tasks = tasks.select do |task|
last_run = SolidQueue::RecurringExecution.where(task_key: task.key).maximum(:run_at)
last_run.nil? || last_run < expected_staleness.ago
end
if stale_tasks.any?
warn(
check_id,
"#{stale_tasks.size} recurring task(s) may be stale: #{stale_tasks.map(&:key).join(', ')}",
suggestion: 'Verify the scheduler process is running'
)
else
pass(check_id, 'Recurring tasks have recent executions')
end
end
end
|