Do not preload settings
What does this MR do?
This fixes problem of hot-reloading sources, visible in: spring, unicorn and rails console:
Reloading...
Settingslogic::MissingSetting: Missing setting 'visibility_level' in 'default_projects_features' section in 'gitlab' section in /home/shinya/workspace/gdk-ce/gitlab/config/gitlab.yml
from /home/shinya/workspace/gdk-ce/gitlab/config/initializers/routing_draw.rb:5:in `instance_eval'
The problem is the ordering of operations:
- First
lib/settings.rb
is loaded, - Then
config/initializers/1_settings.rb
is loaded, - Once reloaded,
- Only
lib/settings.rb
is loaded.
There are probably two approaches:
- Always when reloading also preload
1_settings.rb
, but this has a problem that other initializers do depend on specific configuration, - Store
config/settings.rb
, so outside of eager loadings. It makes it behave as previously, preload will not touchSettings
class.
I took the 2., as the one that is more stable.
Does this MR meet the acceptance criteria?
- Review
-
Has been reviewed by Backend
-
-
Conform by the merge request performance guides -
Conform by the style guides
cc @rymai
Edited by Kamil Trzciński (Back 2025-01-01)