diff --git a/app/assets/javascripts/admin/templates/dashboard.js.handlebars b/app/assets/javascripts/admin/templates/dashboard.js.handlebars index 04858ad3d26..977dbe0275a 100644 --- a/app/assets/javascripts/admin/templates/dashboard.js.handlebars +++ b/app/assets/javascripts/admin/templates/dashboard.js.handlebars @@ -7,7 +7,7 @@ {{i18n admin.dashboard.problems_found}}

diff --git a/app/models/admin_dashboard_data.rb b/app/models/admin_dashboard_data.rb index 8dac0e9534f..29f44536153 100644 --- a/app/models/admin_dashboard_data.rb +++ b/app/models/admin_dashboard_data.rb @@ -10,7 +10,7 @@ class AdminDashboardData @json ||= { reports: REPORTS.map { |type| Report.find(type) }, total_users: User.count, - problems: [rails_env_check, host_names_check].compact + problems: [rails_env_check, host_names_check, gc_checks].compact }.merge( SiteSetting.version_checks? ? {version_check: DiscourseUpdates.check_version} : {} ) @@ -23,4 +23,8 @@ class AdminDashboardData def host_names_check I18n.t("dashboard.host_names_warning") if ['localhost', 'production.localhost'].include?(Discourse.current_hostname) end + + def gc_checks + I18n.t("dashboard.gc_warning") if ENV['RUBY_GC_MALLOC_LIMIT'].nil? + end end \ No newline at end of file diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index c0f91f7269c..f5ff79b2455 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -286,6 +286,7 @@ en: dashboard: rails_env_warning: "Your server is running in %{env} mode." host_names_warning: "Your config/database.yml file is using the default localhost hostname. Update it to use your site's hostname." + gc_warning: 'Your server is using default ruby garbage collection parameters, which will not give you the best performance. Read this topic on performance tuning: Tuning Ruby and Rails for Discourse.' site_settings: default_locale: "The default language of this Discourse instance (ISO 639-1 Code)" diff --git a/spec/models/admin_dashboard_data_spec.rb b/spec/models/admin_dashboard_data_spec.rb index b5c604abe04..9020b955d86 100644 --- a/spec/models/admin_dashboard_data_spec.rb +++ b/spec/models/admin_dashboard_data_spec.rb @@ -40,4 +40,18 @@ describe AdminDashboardData do end end + describe 'gc_checks' do + subject { AdminDashboardData.new.gc_checks } + + it 'returns nil when gc params are set' do + ENV.stubs(:[]).with('RUBY_GC_MALLOC_LIMIT').returns(90000000) + subject.should be_nil + end + + it 'returns a string when gc params are not set' do + ENV.stubs(:[]).with('RUBY_GC_MALLOC_LIMIT').returns(nil) + subject.should_not be_nil + end + end + end \ No newline at end of file