diff options
| author | Winnie Hellmann <winnie@gitlab.com> | 2017-10-20 19:20:29 +0000 |
|---|---|---|
| committer | Winnie Hellmann <winnie@gitlab.com> | 2017-10-20 19:20:29 +0000 |
| commit | 81175d2c37d7bb9768ee21b13207ef57d11ad3ea (patch) | |
| tree | 901b7ca83dbaeab2c3eec5ff013dd47e9ddf8fdd /app | |
| parent | cc8af554fdfa6d54315ae50465c42603a44780b1 (diff) | |
| parent | beeed14f0470e912a2add7a7b94cb1cc1c6adb07 (diff) | |
| download | gitlab-ce-81175d2c37d7bb9768ee21b13207ef57d11ad3ea.tar.gz | |
Merge branch 'fix-application-setting-nil-cache' into 'master'
Prevent ApplicationSetting to cache nil value
Closes #39275
See merge request gitlab-org/gitlab-ce!14952
Diffstat (limited to 'app')
| -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) |
