fix(lighthouse): preserve HTTP capacity under connection load

This commit is contained in:
TakuyaYagam1 committed 2026-10-25 16:52:37 +03:00
1 parent 325879223f
commit a4c618e9f4
2 files changed
+11 -5

No files matched your search

+10 -4
View File
@@ -1,3 +1,4 @@
#define CPPHTTPLIB_LISTEN_BACKLOG 1024
#include <httplib.h>
#include "chronicle.hpp"
@@ -344,10 +345,15 @@ int main() {
try {
initialize();
httplib::Server server;
server.new_task_queue = [] { return new httplib::ThreadPool(32, 64, 256); };
server.set_keep_alive_max_count(8);
server.set_keep_alive_timeout(2);
server.set_read_timeout(3, 0);
// Connections are accepted before cpp-httplib can inspect their route. Keep
// enough short-lived workers for checker traffic during connection floods,
// but bound both the pool and its queue so overload cannot grow without
// limit. Expensive filter compilation has its own much smaller admission
// limit in compiler.hpp.
server.new_task_queue = [] { return new httplib::ThreadPool(64, 192, 512); };
server.set_keep_alive_max_count(2);
server.set_keep_alive_timeout(1);
server.set_read_timeout(0, 250000);
server.set_write_timeout(3, 0);
server.set_payload_max_length(32768);
server.set_pre_routing_handler([](const httplib::Request& request, httplib::Response& response) {