diff --git a/config.sample.yaml b/config.sample.yaml index 90fd029..d49c8de 100644 --- a/config.sample.yaml +++ b/config.sample.yaml @@ -9,6 +9,7 @@ instance: http: port: 4050 + thread_pool_size: 12 database: db_type: "sqlite" diff --git a/src/config/config_http.cpp b/src/config/config_http.cpp index 9c5ddc6..7fcc46f 100644 --- a/src/config/config_http.cpp +++ b/src/config/config_http.cpp @@ -22,6 +22,7 @@ void Config::load_http(Config::HTTP& cfg, YAML::Node& node) try { cfg.port = node["http"]["port"].as(); + cfg.pool_size = node["http"]["thread_pool_size"].as(); } catch(const YAML::BadConversion& err) {} diff --git a/src/config/config_http.h b/src/config/config_http.h index b6b73cc..9f208a1 100644 --- a/src/config/config_http.h +++ b/src/config/config_http.h @@ -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); diff --git a/src/http/microhttpd_server.cpp b/src/http/microhttpd_server.cpp index ba7fc8d..0f9d743 100644 --- a/src/http/microhttpd_server.cpp +++ b/src/http/microhttpd_server.cpp @@ -22,6 +22,7 @@ #include #include #include +#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) {