Dashboard warning when sidekiq is not running

This commit is contained in:
Neil Lalonde
2013-03-22 11:35:32 -04:00
parent d2a3fc8c47
commit 6f8d13d47e
5 changed files with 60 additions and 3 deletions

View File

@@ -9,7 +9,7 @@ class AdminDashboardData
def as_json
@json ||= {
reports: REPORTS.map { |type| Report.find(type) },
problems: [rails_env_check, host_names_check, gc_checks, clockwork_check].compact
problems: [rails_env_check, host_names_check, gc_checks, sidekiq_check || clockwork_check].compact
}.merge(
SiteSetting.version_checks? ? {version_check: DiscourseUpdates.check_version} : {}
)
@@ -27,6 +27,11 @@ class AdminDashboardData
I18n.t("dashboard.gc_warning") if ENV['RUBY_GC_MALLOC_LIMIT'].nil?
end
def sidekiq_check
last_job_performed_at = Jobs.last_job_performed_at
I18n.t('dashboard.sidekiq_warning') if Jobs.queued > 0 and (last_job_performed_at.nil? or last_job_performed_at < 2.minutes.ago)
end
def clockwork_check
I18n.t('dashboard.clockwork_warning') unless Jobs::ClockworkHeartbeat.is_clockwork_running?
end