Skip to content
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

a possible replacement for #1427 #1431

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 14 additions & 19 deletions libraries/app/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1007,32 +1007,27 @@ void application::initialize(const fc::path& data_dir, const boost::program_opti
fc::asio::default_io_service_scope::set_num_threads(num_threads);
}

std::vector<string> wanted;
std::set<string> plugins;

if( options.count("plugins") )
{
boost::split(wanted, options.at("plugins").as<std::string>(), [](char c){return c == ' ';});
boost::split(plugins, options.at("plugins").as<std::string>(), [](char c){return c == ' ';});
}
else
{
wanted.push_back("witness");
wanted.push_back("account_history");
wanted.push_back("market_history");
wanted.push_back("grouped_orders");
plugins.insert("witness");
plugins.insert("account_history");
plugins.insert("market_history");
plugins.insert("grouped_orders");
}
int es_ah_conflict_counter = 0;
for (auto& it : wanted)
{
if(it == "account_history")
++es_ah_conflict_counter;
if(it == "elasticsearch")
++es_ah_conflict_counter;

if(es_ah_conflict_counter > 1) {
elog("Can't start program with elasticsearch and account_history plugin at the same time");
std::exit(EXIT_FAILURE);
}
if (!it.empty()) enable_plugin(it);
}
FC_ASSERT(!(plugins.count("account_history") && plugins.count("elasticsearch")),
"Plugin conflict: Cannot load both account_history plugin and elasticsearch plugin");

std::for_each(plugins.begin(), plugins.end(), [this](const string& plug) mutable {
if (!plug.empty())
enable_plugin(plug);
});
}

void application::startup()
Expand Down