Treat undefined config options as silent fallback in Config::getOption#140
Open
BinqAdams wants to merge 1 commit intoNVIDIAGameWorks:mainfrom
Open
Treat undefined config options as silent fallback in Config::getOption#140BinqAdams wants to merge 1 commit intoNVIDIAGameWorks:mainfrom
BinqAdams wants to merge 1 commit intoNVIDIAGameWorks:mainfrom
Conversation
Config::getOption<T> previously logged "Option failed to parse: <name>" whenever the option wasn't defined in any config file - the empty value would fall through to parseOptionValue, which fails on empty input. Several options are read on hot paths (e.g. client.optimizedDynamicLock fires from the LockableBuffer ctor); a warning per call floods the log at high frequency under heavy buffer creation. An empty looked-up value semantically means the option is undefined, which is exactly what the fallback parameter is for - the contract for absence. Use it silently. Real parse failures (value present but malformed) still emit the warning as before.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stop logging "Option failed to parse" when a bridge config option is simply not defined. Real parse failures (value present but malformed) still warn.
Motivation
Config::getOption<T>(inbridge/src/util/config/config.h) previously loggedLogger::warn("Option failed to parse: <name>")whenever the option wasn't defined in any config file — the empty looked-up value would fall through toparseOptionValue, which fails on empty input. Several options are read on hot paths (e.g.client.optimizedDynamicLockfires from theLockableBufferctor); a per-call warning floods the log at high frequency under heavy buffer creation.An empty looked-up value semantically means the option is undefined, which is exactly what the
fallbackparameter is for — the explicit contract for absence.What Changed
bridge/src/util/config/config.h: inConfig::getOption<T>, short-circuit to the suppliedfallbackwhengetOptionValue(option)returns an empty string. Real parse failures (non-empty value that failsparseOptionValue) still emit theLogger::warnas before.Net diff:
bridge/src/util/config/config.honly, +5.Testing
Verified that:
The behavioral change is limited to the absent-option case, which previously logged but otherwise returned the same fallback value.