fixed idlewatcher panics and incorrect behavior, update screenshot

This commit is contained in:
yusing
2024-10-06 16:17:52 +08:00
parent 03cad9f315
commit de7805f281
6 changed files with 17 additions and 11 deletions

View File

@@ -170,6 +170,10 @@ func (w *watcher) containerStatus() (string, E.NestedError) {
}
func (w *watcher) wakeIfStopped() E.NestedError {
if w.ready.Load() || w.ContainerRunning {
return nil
}
status, err := w.containerStatus()
if err.HasError() {
@@ -249,9 +253,11 @@ func (w *watcher) watchUntilCancel() {
switch {
// create / start / unpause
case e.Action.IsContainerWake():
w.ContainerRunning = true
ticker.Reset(w.IdleTimeout)
w.l.Info(e)
default: // stop / pause / kill
w.ContainerRunning = false
ticker.Stop()
w.ready.Store(false)
w.l.Info(e)