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.
This commit is contained in:
parent
2abc531653
commit
1bcdd25ce2
1 changed files with 13 additions and 0 deletions
|
@ -24,7 +24,20 @@ module Gitlab
|
|||
private
|
||||
|
||||
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'
|
||||
|
||||
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?
|
||||
|
||||
current_settings = ::ApplicationSetting.current
|
||||
|
|
Loading…
Reference in a new issue