fix: avoid scanning cwd during server startup (#2086)

This commit is contained in:
mikemikimike authored and GitHub committed 2026-10-08 23:40:43 +08:00
1 parent a1ded76da5
commit a4a966990d
2 files changed
+8

No files matched your search

+2
View File
@@ -75,6 +75,8 @@ int main(int argc, const char** argv) {
}
SDSvrParams svr_params;
SDContextParams ctx_params;
// Preserve the CLI default while disabling cwd scans for sd-server.
ctx_params.lora_model_dir.clear();
SDGenerationParams default_gen_params;
sd_set_log_callback(sd_log_cb, (void*)&svr_params);
+6
View File
@@ -254,6 +254,12 @@ std::string SDSvrParams::to_string() const {
void refresh_lora_cache(ServerRuntime& rt) {
std::vector<LoraEntry> new_cache;
if (rt.ctx_params->lora_model_dir.empty()) {
std::lock_guard<std::mutex> lock(*rt.lora_mutex);
rt.lora_cache->clear();
return;
}
fs::path lora_dir = rt.ctx_params->lora_model_dir;
std::error_code ec;
if (fs::exists(lora_dir, ec) && !ec && fs::is_directory(lora_dir, ec) && !ec) {