BigW Consortium Gitlab

Commit 78d84587 by DJ Mountney

Only use RequestStore for current_application_settings during a request

This fixes an issue where the RequestStore was being populated with the settings in the unicorn master during the rails initializers. Each forked worker would then start their first request with an uncleaned RequestStore.
parent f9bb9151
module Gitlab module Gitlab
module CurrentSettings module CurrentSettings
def current_application_settings def current_application_settings
key = :current_application_settings if RequestStore.active?
RequestStore.fetch(:current_application_settings) { ensure_application_settings! }
else
ensure_application_settings!
end
end
RequestStore.store[key] ||= begin def ensure_application_settings!
settings = nil settings = nil
if connect_to_db? if connect_to_db?
...@@ -13,7 +18,6 @@ module Gitlab ...@@ -13,7 +18,6 @@ module Gitlab
settings || fake_application_settings settings || fake_application_settings
end end
end
def fake_application_settings def fake_application_settings
OpenStruct.new( OpenStruct.new(
......
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