]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
server : Cmdline arg -to changes http read timeout from current 600sec default (...
authorwbtek <redacted>
Mon, 29 Dec 2025 16:12:48 +0000 (01:12 +0900)
committerGitHub <redacted>
Mon, 29 Dec 2025 16:12:48 +0000 (17:12 +0100)
* Prevent crash if TTFT >300sec, boosted to 90 days

* server : allow configurable HTTP timeouts for child models

* server : pass needed timeouts from params only

---------

Co-authored-by: Greg Slocum <redacted>
tools/server/server-models.cpp
tools/server/server-models.h

index cb7e70455ab57c0cbb66bcb4b25f337175d70e3c..56e1dc46b865c4e9fe8ac57adb34d3742911b707 100644 (file)
@@ -662,7 +662,10 @@ server_http_res_ptr server_models::proxy_request(const server_http_req & req, co
             req.path,
             req.headers,
             req.body,
-            req.should_stop);
+            req.should_stop,
+            base_params.timeout_read,
+            base_params.timeout_write
+            );
     return proxy;
 }
 
@@ -950,13 +953,18 @@ server_http_proxy::server_http_proxy(
         const std::string & path,
         const std::map<std::string, std::string> & headers,
         const std::string & body,
-        const std::function<bool()> should_stop) {
+        const std::function<bool()> should_stop,
+        int32_t timeout_read,
+        int32_t timeout_write
+        ) {
     // shared between reader and writer threads
     auto cli  = std::make_shared<httplib::Client>(host, port);
     auto pipe = std::make_shared<pipe_t<msg_t>>();
 
     // setup Client
     cli->set_connection_timeout(0, 200000); // 200 milliseconds
+    cli->set_write_timeout(timeout_read, 0); // reversed for cli (client) vs srv (server)
+    cli->set_read_timeout(timeout_write, 0);
     this->status = 500; // to be overwritten upon response
     this->cleanup = [pipe]() {
         pipe->close_read();
index 7e33537536a2fe067d9f93afe468f99549cc7987..24ddc656624a7f0a7064cfa6721c4095452b61db 100644 (file)
@@ -183,7 +183,10 @@ public:
                       const std::string & path,
                       const std::map<std::string, std::string> & headers,
                       const std::string & body,
-                      const std::function<bool()> should_stop);
+                      const std::function<bool()> should_stop,
+                      int32_t timeout_read,
+                      int32_t timeout_write
+                      );
     ~server_http_proxy() {
         if (cleanup) {
             cleanup();