Commit c8eb1dcc authored by DJ Mountney's avatar DJ Mountney

Try and use cache for application settings even when the db is not connected

parent 7d57b110
......@@ -98,6 +98,10 @@ class ApplicationSetting < ActiveRecord::Base
Rails.cache.delete(CACHE_KEY)
end
def self.cached
Rails.cache.fetch(CACHE_KEY)
end
def self.create_from_defaults
create(
default_projects_limit: Settings.gitlab['default_projects_limit'],
......
......@@ -9,9 +9,9 @@ module Gitlab
end
def ensure_application_settings!
settings = nil
settings = ::ApplicationSetting.cached
if connect_to_db?
if !settings && connect_to_db?
settings = ::ApplicationSetting.current
settings ||= ::ApplicationSetting.create_from_defaults unless ActiveRecord::Migrator.needs_migration?
end
......
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