0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-06 13:08:40 +08:00
discourse/app/jobs/scheduled/run_problem_checks.rb
Alan Guo Xiang Tan a6413265f4
FEATURE: Add Site Advice section to the redesigned admin dashboard (#40969)
This PR adds a "Site Advice" section to the redesigned admin dashboard
that surfaces failing problem checks to staff.

<img width="1079" height="463" alt="CleanShot 2026-06-23 at 11 26 54"
src="https://github.com/user-attachments/assets/b1a2a4dd-cf34-4f11-8fc7-3a973d3e08db"
/>

---------

Co-authored-by: chapoi <101828855+chapoi@users.noreply.github.com>
2026-06-23 11:57:49 +02:00

32 lines
902 B
Ruby
Vendored

# frozen_string_literal: true
module Jobs
# This job runs all of the scheduled problem checks for the admin dashboard
# on a regular basis. To add a problem check, add a new class that inherits
# the `ProblemCheck` base class.
class RunProblemChecks < ::Jobs::Scheduled
sidekiq_options retry: false
every 10.minutes
def execute(_args)
ProblemCheck.scheduled.filter_map do |scheduled_check|
scheduled_check.each_target do |target|
next if target == ProblemCheck::NO_TARGET && scheduled_check.targeted?
check = scheduled_check.new(target)
if check.enabled? && check.ready_to_run?
Jobs.enqueue(
:run_problem_check,
check_identifier: check.identifier.to_s,
target: target.to_s,
)
end
end
end
ProblemCheck.realtime.run_all
end
end
end