Skip to content

Commit

Permalink
Setting loading
Browse files Browse the repository at this point in the history
  • Loading branch information
ezr-ondrej authored and ofedoren committed Jul 1, 2022
1 parent 54d3737 commit 362dae5
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions app/services/setting_registry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,9 @@ def load_definitions
end
end

def known_categories
unless @known_descendants == Setting.descendants
@known_descendants = Setting.descendants
@known_categories = @known_descendants.map(&:name) << 'Setting'
@values_loaded_at = nil # force all values to be reloaded
end
@known_categories
end

def load_values(ignore_cache: false)
# we are loading only known STIs as we load settings fairly early the first time and plugin classes might not be loaded yet.
settings = Setting.unscoped.where(category: known_categories).where.not(value: nil)
settings = Setting.unscoped.where(category: 'Setting').where.not(value: nil)
settings = settings.where('updated_at >= ?', @values_loaded_at) unless ignore_cache || @values_loaded_at.nil?
settings.each do |s|
unless (definition = find(s.name))
Expand Down

0 comments on commit 362dae5

Please sign in to comment.