fix(initializer): correctly reap dangling processes (#3717)

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
Ettore Di Giacinto 2024-10-02 20:37:40 +02:00 committed by GitHub
parent e5586e8781
commit 4686877c6d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 14 additions and 4 deletions

View file

@ -18,14 +18,18 @@ import (
func (ml *ModelLoader) deleteProcess(s string) error {
defer delete(ml.models, s)
log.Debug().Msgf("Deleting process %s", s)
m, exists := ml.models[s]
if !exists {
log.Error().Msgf("Model does not exist %s", s)
// Nothing to do
return nil
}
process := m.Process()
if process == nil {
log.Error().Msgf("No process for %s", s)
// Nothing to do as there is no process
return nil
}