This repository has been archived by the owner on Aug 2, 2022. It is now read-only.
call boost program option notifiers before plugin initialize #9207
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.
Change Description
This PR changes boost program option notifiers to fire before plugin initialization instead of after initialization but before startup. Current behavior has bitten me an embarrassing number of times and I’m not immediately sure of any drawback moving the notifiers earlier given our typical plugin pattern.
Using notifiers, IMO, cleans up option handling. For example, without using the notifiers our typical pattern is something like
But using the notifiers it can be more like
In particular notice that the
https-server-address
string doesn't have to be copy pastaed around, and that there is no need for theoptions.at("https-server-address").as<string>();
mouthful.But the code above won't work today because the notifiers are fired after plugin_initialize() (before startup()). This PR moves the notifiers to occur before plugin_initialize() allowing plugin_initialize() to make use of values set in notifiers.
Change Type
Select ONE
Consensus Changes
API Changes
Documentation Additions