concurrency option added

This commit is contained in:
moneroexamples 2019-05-27 11:38:46 +08:00
parent 7fca3a5df7
commit 2e32839740
2 changed files with 12 additions and 2 deletions

View file

@ -75,6 +75,7 @@ main(int ac, const char* av[])
auto enable_json_api_opt = opts.get_option<bool>("enable-json-api");
auto enable_as_hex_opt = opts.get_option<bool>("enable-as-hex");
auto enable_tx_cache_opt = opts.get_option<bool>("enable-tx-cache");
auto concurrency_opt = opts.get_option<size_t>("concurrency");
auto enable_block_cache_opt = opts.get_option<bool>("enable-block-cache");
auto show_cache_times_opt = opts.get_option<bool>("show-cache-times");
auto enable_emission_monitor_opt = opts.get_option<bool>("enable-emission-monitor");
@ -865,10 +866,17 @@ main(int ac, const char* av[])
else
{
cout << "Staring in non-ssl mode" << endl;
app.bindaddr(bindaddr).port(app_port).multithreaded().run();
if (*concurrency_opt == 0)
{
app.bindaddr(bindaddr).port(app_port).multithreaded().run();
}
else
{
app.bindaddr(bindaddr).port(app_port)
.concurrency(*concurrency_opt).run();
}
}
if (enable_emission_monitor == true)
{
// finish Emission monitoring thread in a cotrolled manner.

View file

@ -67,6 +67,8 @@ namespace xmreg
"maximum time, in milliseconds, to wait for mempool data for the front page")
("mempool-refresh-time", value<string>()->default_value("5"),
"time, in seconds, for each refresh of mempool state")
("concurrency,c", value<size_t>()->default_value(0),
"number of threads handling http queries. Default is 0 which means it is based you on the cpu")
("bc-path,b", value<string>(),
"path to lmdb folder of the blockchain, e.g., ~/.bitmonero/lmdb")
("ssl-crt-file", value<string>(),