Skip to content
Snippets Groups Projects
Commit 69e9c414 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Merge branch 'expire-application-settings-startup' of https://gitlab.com/stanhu/gitlab-ce

parents c48518ac 78c1ab40
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
 
v 8.3.0 (unreleased)
- Fix Error 500 when viewing user's personal projects from admin page (Stan Hu)
- Ensure cached application settings are refreshed at startup (Stan Hu)
- Fix: Assignee selector is empty when 'Unassigned' is selected (Jose Corcuera)
- Fix 500 error when update group member permission
- Fix: Raw private snippets access workflow
Loading
Loading
Loading
Loading
@@ -73,15 +73,23 @@ class ApplicationSetting < ActiveRecord::Base
end
 
after_commit do
Rails.cache.write('application_setting.last', self)
Rails.cache.write(cache_key, self)
end
 
def self.current
Rails.cache.fetch('application_setting.last') do
Rails.cache.fetch(cache_key) do
ApplicationSetting.last
end
end
 
def self.expire
Rails.cache.delete(cache_key)
end
def self.cache_key
'application_setting.last'
end
def self.create_from_defaults
create(
default_projects_limit: Settings.gitlab['default_projects_limit'],
Loading
Loading
Loading
Loading
@@ -14,11 +14,15 @@ module Ci
extend Ci::Model
 
after_commit do
Rails.cache.write('ci_application_setting.last', self)
Rails.cache.write(cache_key, self)
end
def self.expire
Rails.cache.delete(cache_key)
end
 
def self.current
Rails.cache.fetch('ci_application_setting.last') do
Rails.cache.fetch(cache_key) do
Ci::ApplicationSetting.last
end
end
Loading
Loading
@@ -29,5 +33,9 @@ module Ci
add_pusher: Settings.gitlab_ci['add_pusher'],
)
end
def self.cache_key
'ci_application_setting.last'
end
end
end
Loading
Loading
@@ -293,3 +293,12 @@ if Rails.env.test?
Settings.gitlab['default_can_create_group'] = true
Settings.gitlab['default_can_create_team'] = false
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment