Skip to content

Move caching logic from CurrentSettings to ApplicationSettingFetcher

What does this MR do and why?

Related issue: #417763 (closed)

Currently, we have settings in ApplicationSetting class. These are accessed using Gitlab::CurrentSetting class. With cells, we will have settings that will move from ApplicationSetting to OrganizationSetting. But we want to keep accessing settings using Gitlab::CurrentSetting.

This MR is the first step of removing ApplicationSetting related logic from CurrentSetting to a new ApplicationSettingFetcher class. It introduces that class and moves the private cached_application_setting to this new class.

Next MR will be related to uncached_application_setting logic (which is more complicated)

Note: in a earlier version of this MR, it was suggested to use a feature flag. However, there is a warning: "Don’t use feature flags at application load time." Gitlab::CurrentSettings is used in initializers so we can not use Feature Flags. By limiting the size of the MR, we can limit the impact of this change.

How to set up and validate locally

Using GDK: Test if updating settings will still reset the cache

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Rutger Wessels

Merge request reports