diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-10-19 15:07:18 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-10-19 15:07:35 +0300 |
commit | 64fd9814fdbcd2edf6a282568c645c5b2c0663e2 (patch) | |
tree | 5d5b682af1d39987ca4bccc17b620fbe3e6633c9 /app/models/application_setting.rb | |
parent | 1090514ab407b7faa894cbd9b6cd769c376a9b5d (diff) | |
download | gitlab-ce-64fd9814fdbcd2edf6a282568c645c5b2c0663e2.tar.gz |
Prevent ApplicationSetting to cache nil value
Diffstat (limited to 'app/models/application_setting.rb')
-rw-r--r-- | app/models/application_setting.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index d3b8debb0fd..4dda276bb41 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -203,7 +203,10 @@ class ApplicationSetting < ActiveRecord::Base ensure_cache_setup Rails.cache.fetch(CACHE_KEY) do - ApplicationSetting.last + ApplicationSetting.last.tap do |settings| + # do not cache nils + raise 'missing settings' unless settings + end end rescue # Fall back to an uncached value if there are any problems (e.g. redis down) |