Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 128757d

Browse files
committed
fix: unload engine before updating
1 parent 257573b commit 128757d

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

engine/controllers/engines.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,8 @@ void Engines::UpdateEngine(
379379
metadata = (*exist_engine).metadata;
380380
}
381381

382+
(void) engine_service_->UnloadEngine(engine);
383+
382384
auto upd_res =
383385
engine_service_->UpsertEngine(engine, type, api_key, url, version,
384386
"all-platforms", status, metadata);

engine/services/engine_service.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -906,10 +906,10 @@ cpp::result<void, std::string> EngineService::UnloadEngine(
906906
auto unload_opts = EngineI::EngineUnloadOption{};
907907
e->Unload(unload_opts);
908908
delete e;
909-
engines_.erase(ne);
910909
} else {
911910
delete std::get<RemoteEngineI*>(engines_[ne].engine);
912911
}
912+
engines_.erase(ne);
913913

914914
CTL_DBG("Engine unloaded: " + ne);
915915
return {};

engine/services/model_service.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,6 +1255,8 @@ cpp::result<std::optional<std::string>, std::string>
12551255
ModelService::MayFallbackToCpu(const std::string& model_path, int ngl,
12561256
int ctx_len, int n_batch, int n_ubatch,
12571257
const std::string& kv_cache_type) {
1258+
// TODO(sang) temporary disable this function
1259+
return std::nullopt;
12581260
assert(hw_service_);
12591261
auto hw_info = hw_service_->GetHardwareInfo();
12601262
assert(!!engine_svc_);

0 commit comments

Comments
 (0)