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

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

* only allow is_first_load to populate it

* nits

* nits 2
This commit is contained in:
Xuan-Son Nguyen authored and GitHub committed 2026-08-20 15:22:16 +02:00
1 parent 8a832e4bf3
commit 9855ad69d3
4 files changed
+55 -36

No files matched your search

+12
View File
@@ -424,6 +424,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]() {