mirror of
https://github.com/discourse/discourse.git
synced 2025-06-02 12:54:32 +08:00
Dashboard memory warning
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
require_dependency 'mem_info'
|
||||
|
||||
class AdminDashboardData
|
||||
|
||||
REPORTS = ['visits', 'signups', 'topics', 'posts', 'flags', 'users_by_trust_level', 'likes', 'emails']
|
||||
@ -9,7 +11,7 @@ class AdminDashboardData
|
||||
def as_json
|
||||
@json ||= {
|
||||
reports: REPORTS.map { |type| Report.find(type) },
|
||||
problems: [rails_env_check, host_names_check, gc_checks, sidekiq_check || clockwork_check].compact
|
||||
problems: [rails_env_check, host_names_check, gc_checks, sidekiq_check || clockwork_check, ram_check].compact
|
||||
}.merge(
|
||||
SiteSetting.version_checks? ? {version_check: DiscourseUpdates.check_version} : {}
|
||||
)
|
||||
@ -35,4 +37,8 @@ class AdminDashboardData
|
||||
def clockwork_check
|
||||
I18n.t('dashboard.clockwork_warning') unless Jobs::ClockworkHeartbeat.is_clockwork_running?
|
||||
end
|
||||
|
||||
def ram_check
|
||||
I18n.t('dashboard.memory_warning') if MemInfo.new.mem_total and MemInfo.new.mem_total < 1_000_000
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user