Commit 1bcdd25c authored by Stan Hu's avatar Stan Hu Committed by Rémy Coutable

Avoid sequential scans loading schema_migrations table when loading application settings

This was causing significant performance problems in production, and this commit
reverts to the original behavior.
parent 2abc5316
...@@ -24,7 +24,20 @@ module Gitlab ...@@ -24,7 +24,20 @@ module Gitlab
private private
def ensure_application_settings! def ensure_application_settings!
cached_application_settings || uncached_application_settings
end
def cached_application_settings
return in_memory_application_settings if ENV['IN_MEMORY_APPLICATION_SETTINGS'] == 'true' return in_memory_application_settings if ENV['IN_MEMORY_APPLICATION_SETTINGS'] == 'true'
begin
::ApplicationSetting.cached
rescue ::Redis::BaseError, ::Errno::ENOENT, ::Errno::EADDRNOTAVAIL
# In case Redis isn't running or the Redis UNIX socket file is not available
end
end
def uncached_application_settings
return fake_application_settings unless connect_to_db? return fake_application_settings unless connect_to_db?
current_settings = ::ApplicationSetting.current current_settings = ::ApplicationSetting.current
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment