mirror of
https://github.com/mudler/LocalAI.git
synced 2024-12-18 20:27:57 +00:00
feat(shutdown): allow force shutdown of backends (#3733)
We default to a soft kill, however, we might want to force killing backends after a while to avoid hanging requests (which may hallucinate indefinetly) Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
parent
905473c739
commit
e28e80857b
@ -157,6 +157,11 @@ func (ml *ModelLoader) ShutdownModel(modelName string) error {
|
||||
}
|
||||
time.Sleep(dur)
|
||||
retries++
|
||||
|
||||
if retries > 10 && os.Getenv("LOCALAI_FORCE_BACKEND_SHUTDOWN") == "true" {
|
||||
log.Warn().Msgf("Model %s is still busy after %d retries. Forcing shutdown.", modelName, retries)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return ml.deleteProcess(modelName)
|
||||
|
Loading…
Reference in New Issue
Block a user