mirror of
https://github.com/mudler/LocalAI.git
synced 2025-05-20 10:35:01 +00:00
fix(shutdown): do not shutdown immediately busy backends (#3543)
* fix(shutdown): do not shutdown immediately busy backends Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * chore(refactor): avoid duplicate functions Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * fix: multiplicative backoff for shutdown (#3547) * multiplicative backoff for shutdown Rather than always retry every two seconds, back off the shutdown attempt rate? Signed-off-by: Dave <dave@gray101.com> * Update loader.go Signed-off-by: Dave <dave@gray101.com> * add clamp of 2 minutes Signed-off-by: Dave Lee <dave@gray101.com> --------- Signed-off-by: Dave <dave@gray101.com> Signed-off-by: Dave Lee <dave@gray101.com> --------- Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Signed-off-by: Dave <dave@gray101.com> Signed-off-by: Dave Lee <dave@gray101.com> Co-authored-by: Dave <dave@gray101.com>
This commit is contained in:
parent
0e4e101101
commit
d0f2bf3181
2 changed files with 26 additions and 15 deletions
|
@ -18,15 +18,16 @@ import (
|
|||
|
||||
func (ml *ModelLoader) StopAllExcept(s string) error {
|
||||
return ml.StopGRPC(func(id string, p *process.Process) bool {
|
||||
if id != s {
|
||||
for ml.models[id].GRPC(false, ml.wd).IsBusy() {
|
||||
log.Debug().Msgf("%s busy. Waiting.", id)
|
||||
time.Sleep(2 * time.Second)
|
||||
}
|
||||
log.Debug().Msgf("[single-backend] Stopping %s", id)
|
||||
return true
|
||||
if id == s {
|
||||
return false
|
||||
}
|
||||
return false
|
||||
|
||||
for ml.models[id].GRPC(false, ml.wd).IsBusy() {
|
||||
log.Debug().Msgf("%s busy. Waiting.", id)
|
||||
time.Sleep(2 * time.Second)
|
||||
}
|
||||
log.Debug().Msgf("[single-backend] Stopping %s", id)
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue