From e745e1aae0880d65b9e9bd3f7b3aeb0bfce1613b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9my=20Coutable?= <remy@rymai.me>
Date: Thu, 26 Jan 2017 12:45:14 +0100
Subject: [PATCH] Move a begin/rescue clause to ApplicationSetting.expire
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Also, remove non-existing Ci::ApplicationSetting.expire!

Signed-off-by: Rémy Coutable <remy@rymai.me>
---
 app/models/application_setting.rb | 3 +++
 config/initializers/1_settings.rb | 8 +-------
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb
index e33a58d3771..6b3f0d4ee20 100644
--- a/app/models/application_setting.rb
+++ b/app/models/application_setting.rb
@@ -199,6 +199,9 @@ class ApplicationSetting < ActiveRecord::Base
 
   def self.expire
     Rails.cache.delete(CACHE_KEY)
+  rescue
+    # Gracefully handle when Redis is not available. For example,
+    # omnibus may fail here during assets:precompile.
   end
 
   def self.cached
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb
index 906ec11f012..4f33aad8693 100644
--- a/config/initializers/1_settings.rb
+++ b/config/initializers/1_settings.rb
@@ -419,10 +419,4 @@ if Rails.env.test?
 end
 
 # Force a refresh of application settings at startup
-begin
-  ApplicationSetting.expire
-  Ci::ApplicationSetting.expire
-rescue
-  # Gracefully handle when Redis is not available. For example,
-  # omnibus may fail here during assets:precompile.
-end
+ApplicationSetting.expire
-- 
GitLab