refactor(userspace/falco): support zlib and custom threadiness in webserver

Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
This commit is contained in:
Jason Dellaluce
2022-06-23 08:59:49 +00:00
committed by poiana
parent d9b6473db2
commit 0eacd41cd5
2 changed files with 6 additions and 0 deletions

View File

@@ -15,6 +15,7 @@ limitations under the License.
*/
#include "webserver.h"
#include "falco_utils.h"
#include <atomic>
falco_webserver::~falco_webserver()
@@ -46,6 +47,10 @@ void falco_webserver::start(
m_server = new httplib::Server();
}
// configure server
auto threadiness = std::min(2u, falco::utils::hardware_concurrency());
m_server->new_task_queue = [&threadiness] { return new httplib::ThreadPool(threadiness); };
// setup healthz endpoint
m_server->Get(healthz_endpoint,
[](const httplib::Request &, httplib::Response &res) {

View File

@@ -16,6 +16,7 @@ limitations under the License.
#pragma once
#define CPPHTTPLIB_OPENSSL_SUPPORT
#define CPPHTTPLIB_ZLIB_SUPPORT
#include <httplib.h>
#include <thread>
#include "configuration.h"