fix: do not keep track model if not existing (#8603)

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
Ettore Di Giacinto
2026-02-19 17:18:38 +01:00
committed by GitHub
parent dadc7158fb
commit 76fba02e56
2 changed files with 6 additions and 2 deletions

View File

@@ -17,11 +17,15 @@ import (
var forceBackendShutdown bool = os.Getenv("LOCALAI_FORCE_BACKEND_SHUTDOWN") == "true"
var (
modelNotFoundErr = errors.New("model not found")
)
func (ml *ModelLoader) deleteProcess(s string) error {
model, ok := ml.models[s]
if !ok {
xlog.Debug("Model not found", "model", s)
return fmt.Errorf("model %s not found", s)
return modelNotFoundErr
}
retries := 1

View File

@@ -540,7 +540,7 @@ func (wd *WatchDog) evictLRUModel() {
wd.Unlock()
// Shutdown the model
if err := wd.pm.ShutdownModel(lruModel.model); err != nil {
if err := wd.pm.ShutdownModel(lruModel.model); err != nil && err != modelNotFoundErr {
xlog.Error("[WatchDog] error shutting down model during memory reclamation", "error", err, "model", lruModel.model)
} else {
// Untrack the model