mirror of
https://github.com/mudler/LocalAI.git
synced 2025-05-20 10:35:01 +00:00
fix(watchdog): use ShutdownModel instead of StopModel (#1882)
Fixes #1760
This commit is contained in:
parent
49cec7fd61
commit
bd25d8049c
2 changed files with 7 additions and 6 deletions
|
@ -30,7 +30,7 @@ type WatchDog struct {
|
|||
}
|
||||
|
||||
type ProcessManager interface {
|
||||
StopModel(modelName string) error
|
||||
ShutdownModel(modelName string) error
|
||||
}
|
||||
|
||||
func NewWatchDog(pm ProcessManager, timeoutBusy, timeoutIdle time.Duration, busy, idle bool) *WatchDog {
|
||||
|
@ -112,9 +112,10 @@ func (wd *WatchDog) checkIdle() {
|
|||
log.Warn().Msgf("[WatchDog] Address %s is idle for too long, killing it", address)
|
||||
p, ok := wd.addressModelMap[address]
|
||||
if ok {
|
||||
if err := wd.pm.StopModel(p); err != nil {
|
||||
if err := wd.pm.ShutdownModel(p); err != nil {
|
||||
log.Error().Msgf("[watchdog] Error shutting down model %s: %v", p, err)
|
||||
}
|
||||
log.Debug().Msgf("[WatchDog] model shut down: %s", address)
|
||||
delete(wd.idleTime, address)
|
||||
delete(wd.addressModelMap, address)
|
||||
delete(wd.addressMap, address)
|
||||
|
@ -139,9 +140,10 @@ func (wd *WatchDog) checkBusy() {
|
|||
model, ok := wd.addressModelMap[address]
|
||||
if ok {
|
||||
log.Warn().Msgf("[WatchDog] Model %s is busy for too long, killing it", model)
|
||||
if err := wd.pm.StopModel(model); err != nil {
|
||||
if err := wd.pm.ShutdownModel(model); err != nil {
|
||||
log.Error().Msgf("[watchdog] Error shutting down model %s: %v", model, err)
|
||||
}
|
||||
log.Debug().Msgf("[WatchDog] model shut down: %s", address)
|
||||
delete(wd.timetable, address)
|
||||
delete(wd.addressModelMap, address)
|
||||
delete(wd.addressMap, address)
|
||||
|
@ -149,7 +151,6 @@ func (wd *WatchDog) checkBusy() {
|
|||
log.Warn().Msgf("[WatchDog] Address %s unresolvable", address)
|
||||
delete(wd.timetable, address)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue