Add thread pool size to config
FossilOrigin-Name: e7a3187b94e5a277a7bb0126e6e599f5a788ec695e428440dc755aac71376081
This commit is contained in:
parent
e37dd9dfb6
commit
1420a219ee
4 changed files with 6 additions and 0 deletions
|
@ -9,6 +9,7 @@ instance:
|
|||
|
||||
http:
|
||||
port: 4050
|
||||
thread_pool_size: 12
|
||||
|
||||
database:
|
||||
db_type: "sqlite"
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
void Config::load_http(Config::HTTP& cfg, YAML::Node& node)
|
||||
try {
|
||||
cfg.port = node["http"]["port"].as<unsigned>();
|
||||
cfg.pool_size = node["http"]["thread_pool_size"].as<unsigned>();
|
||||
}
|
||||
catch(const YAML::BadConversion& err)
|
||||
{}
|
||||
|
|
|
@ -27,6 +27,7 @@ namespace Config
|
|||
struct HTTP
|
||||
{
|
||||
uint16_t port{8080};
|
||||
uint16_t pool_size{8};
|
||||
};
|
||||
|
||||
void load_http(Config::HTTP& cfg, YAML::Node& node);
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <utility>
|
||||
#include <microhttpd.h>
|
||||
#include <cerrno>
|
||||
#include "config/config_loader.h"
|
||||
#include "logger.h"
|
||||
#include "microhttpd_server.h"
|
||||
#include "http/mime.h"
|
||||
|
@ -183,6 +184,8 @@ void MicroHttpdServer::start()
|
|||
MHD_OPTION_NOTIFY_CONNECTION,
|
||||
request_completed,
|
||||
this,
|
||||
MHD_OPTION_THREAD_POOL_SIZE,
|
||||
Config::instance().config.http.pool_size,
|
||||
MHD_OPTION_END);
|
||||
if (!dm)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue