feat(idlesleep): support container dependencies, including custom and docker depends_on, code refactor

This commit is contained in:
yusing
2025-06-04 23:26:38 +08:00
parent 22ab043e06
commit a39d527fc1
15 changed files with 507 additions and 152 deletions

View File

@@ -2,7 +2,6 @@ package idlewatcher
import (
"context"
"errors"
"net"
"time"
@@ -53,22 +52,13 @@ func (w *Watcher) wakeFromStream() error {
}
w.l.Debug().Msg("wake signal received")
err := w.wakeIfStopped()
err := w.Wake(context.Background())
if err != nil {
return err
}
ctx, cancel := context.WithTimeoutCause(w.task.Context(), w.cfg.WakeTimeout, errors.New("wake timeout"))
defer cancel()
var ready bool
for {
if w.cancelled(ctx) {
return context.Cause(ctx)
}
w, ready, err = checkUpdateState(w.Key())
ready, err := w.checkUpdateState()
if err != nil {
return err
}