concurrency option added

master
moneroexamples 6 years ago
parent 7fca3a5df7
commit 2e32839740

@ -75,6 +75,7 @@ main(int ac, const char* av[])
auto enable_json_api_opt = opts.get_option<bool>("enable-json-api"); 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_as_hex_opt = opts.get_option<bool>("enable-as-hex");
auto enable_tx_cache_opt = opts.get_option<bool>("enable-tx-cache"); 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 enable_block_cache_opt = opts.get_option<bool>("enable-block-cache");
auto show_cache_times_opt = opts.get_option<bool>("show-cache-times"); auto show_cache_times_opt = opts.get_option<bool>("show-cache-times");
auto enable_emission_monitor_opt = opts.get_option<bool>("enable-emission-monitor"); auto enable_emission_monitor_opt = opts.get_option<bool>("enable-emission-monitor");
@ -865,9 +866,16 @@ main(int ac, const char* av[])
else else
{ {
cout << "Staring in non-ssl mode" << endl; cout << "Staring in non-ssl mode" << endl;
if (*concurrency_opt == 0)
{
app.bindaddr(bindaddr).port(app_port).multithreaded().run(); app.bindaddr(bindaddr).port(app_port).multithreaded().run();
} }
else
{
app.bindaddr(bindaddr).port(app_port)
.concurrency(*concurrency_opt).run();
}
}
if (enable_emission_monitor == true) if (enable_emission_monitor == true)
{ {

@ -67,6 +67,8 @@ namespace xmreg
"maximum time, in milliseconds, to wait for mempool data for the front page") "maximum time, in milliseconds, to wait for mempool data for the front page")
("mempool-refresh-time", value<string>()->default_value("5"), ("mempool-refresh-time", value<string>()->default_value("5"),
"time, in seconds, for each refresh of mempool state") "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>(), ("bc-path,b", value<string>(),
"path to lmdb folder of the blockchain, e.g., ~/.bitmonero/lmdb") "path to lmdb folder of the blockchain, e.g., ~/.bitmonero/lmdb")
("ssl-crt-file", value<string>(), ("ssl-crt-file", value<string>(),

Loading…
Cancel
Save