-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[5.0] more robust chain_api_plugin
check in producer_plugin
#2106
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1212,14 +1212,12 @@ void producer_plugin_impl::plugin_initialize(const boost::program_options::varia | |
if (options.count("read-only-threads")) { | ||
_ro_thread_pool_size = options.at("read-only-threads").as<uint32_t>(); | ||
} else if (_producers.empty()) { | ||
if (options.count("plugin")) { | ||
const auto& v = options.at("plugin").as<std::vector<std::string>>(); | ||
auto i = std::find_if(v.cbegin(), v.cend(), [](const std::string& p) { return p == "eosio::chain_api_plugin"; }); | ||
if (i != v.cend()) { | ||
// default to 3 threads for non producer nodes running chain_api_plugin if not specified | ||
_ro_thread_pool_size = 3; | ||
ilog("chain_api_plugin configured, defaulting read-only-threads to ${t}", ("t", _ro_thread_pool_size)); | ||
} | ||
//appbase initializes configured plugins before auto-start plugins, so if chain_api_plugin is enabled it's | ||
// initialized before producer_plugin (i.e. before this code here) | ||
if (abstract_plugin* capi = app().find_plugin("eosio::chain_api_plugin"); capi && capi->get_state() == abstract_plugin::initialized) { | ||
// default to 3 threads for non producer nodes running chain_api_plugin if not specified | ||
_ro_thread_pool_size = 3; | ||
ilog("chain_api_plugin configured, defaulting read-only-threads to ${t}", ("t", _ro_thread_pool_size)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another approach would have been to change the previous check from The downside is that the check is reliant on plugin initialization ordering semantics that are arguably an implementation detail of appbase, and that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about adding There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That would require adding |
||
} | ||
} | ||
EOS_ASSERT(producer_plugin::test_mode_ || _ro_thread_pool_size == 0 || _producers.empty(), plugin_config_exception, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/AntelopeIO/appbase/blob/b75b31e14f966fa3de6246e120dcba36c6ce5264/application_base.cpp#L397-L416