server: (router) lazy-load startup_models after main setup

This commit is contained in:
Xuan Son Nguyen
2026-08-20 01:56:18 +02:00
parent d59d455fd8
commit c47322cc8a
3 changed files with 34 additions and 4 deletions
+12
View File
@@ -423,6 +423,18 @@ int llama_server(common_params & params, int argc, char ** argv) {
ctx_http.stop();
};
try {
models_routes->models.load_startup_models();
} catch (const std::exception & e) {
SRV_ERR("failed to load models on startup: %s\n", e.what());
ctx_http.stop();
if (ctx_http.thread.joinable()) {
ctx_http.thread.join();
}
clean_up();
return 1;
}
} else {
// setup clean up function, to be called before exit
clean_up = [&ctx_http, &ctx_server, &mcp_mgr]() {