lib/new_relic/agent/configuration/manager.rb in newrelic_rpm-9.2.0 vs lib/new_relic/agent/configuration/manager.rb in newrelic_rpm-9.2.1

- old
+ new

@@ -13,10 +13,12 @@ module NewRelic module Agent module Configuration class Manager + DEPENDENCY_DETECTION_VALUES = %i[prepend chain].freeze + # Defining these explicitly saves object allocations that we incur # if we use Forwardable and def_delegators. def [](key) @cache[key] end @@ -355,10 +357,21 @@ @configs_for_testing = [] reset_cache end + # reset the configuration hash, but do not replace previously auto + # determined dependency detection values with nil or 'auto' def reset_cache + return new_cache unless defined?(@cache) && @cache + + preserved = @cache.select { |_k, v| DEPENDENCY_DETECTION_VALUES.include?(v) } + new_cache + preserved.each { |k, v| @cache[k] = v unless @cache[k] && @cache[k] != 'auto' } + @cache + end + + def new_cache @cache = Hash.new { |hash, key| hash[key] = self.fetch(key) } end def log_config(direction, source) # Just generating this log message (specifically calling