Dashboard warning when GC params are default
This commit is contained in:
parent
c8508d3f26
commit
d28d81a590
|
@ -7,7 +7,7 @@
|
||||||
{{i18n admin.dashboard.problems_found}}
|
{{i18n admin.dashboard.problems_found}}
|
||||||
<ul>
|
<ul>
|
||||||
{{#each problem in problems}}
|
{{#each problem in problems}}
|
||||||
<li>{{problem}}</li>
|
<li>{{{problem}}}</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ul>
|
</ul>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -10,7 +10,7 @@ class AdminDashboardData
|
||||||
@json ||= {
|
@json ||= {
|
||||||
reports: REPORTS.map { |type| Report.find(type) },
|
reports: REPORTS.map { |type| Report.find(type) },
|
||||||
total_users: User.count,
|
total_users: User.count,
|
||||||
problems: [rails_env_check, host_names_check].compact
|
problems: [rails_env_check, host_names_check, gc_checks].compact
|
||||||
}.merge(
|
}.merge(
|
||||||
SiteSetting.version_checks? ? {version_check: DiscourseUpdates.check_version} : {}
|
SiteSetting.version_checks? ? {version_check: DiscourseUpdates.check_version} : {}
|
||||||
)
|
)
|
||||||
|
@ -23,4 +23,8 @@ class AdminDashboardData
|
||||||
def host_names_check
|
def host_names_check
|
||||||
I18n.t("dashboard.host_names_warning") if ['localhost', 'production.localhost'].include?(Discourse.current_hostname)
|
I18n.t("dashboard.host_names_warning") if ['localhost', 'production.localhost'].include?(Discourse.current_hostname)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def gc_checks
|
||||||
|
I18n.t("dashboard.gc_warning") if ENV['RUBY_GC_MALLOC_LIMIT'].nil?
|
||||||
|
end
|
||||||
end
|
end
|
|
@ -286,6 +286,7 @@ en:
|
||||||
dashboard:
|
dashboard:
|
||||||
rails_env_warning: "Your server is running in %{env} mode."
|
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."
|
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: <a href="http://meta.discourse.org/t/tuning-ruby-and-rails-for-discourse/4126">Tuning Ruby and Rails for Discourse</a>.'
|
||||||
|
|
||||||
site_settings:
|
site_settings:
|
||||||
default_locale: "The default language of this Discourse instance (ISO 639-1 Code)"
|
default_locale: "The default language of this Discourse instance (ISO 639-1 Code)"
|
||||||
|
|
|
@ -40,4 +40,18 @@ describe AdminDashboardData do
|
||||||
end
|
end
|
||||||
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
|
end
|
Loading…
Reference in New Issue