mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-23 01:08:47 +02:00
fix(idlewatcher): wake time outs before actual timeout
This commit is contained in:
@@ -186,18 +186,17 @@ func (w *Watcher) Key() string {
|
||||
return w.cfg.Key()
|
||||
}
|
||||
|
||||
func (w *Watcher) Wake() error {
|
||||
return w.wakeIfStopped()
|
||||
func (w *Watcher) Wake(ctx context.Context) error {
|
||||
}
|
||||
|
||||
func (w *Watcher) wakeIfStopped() error {
|
||||
func (w *Watcher) wakeIfStopped(ctx context.Context) error {
|
||||
state := w.state.Load()
|
||||
if state.status == idlewatcher.ContainerStatusRunning {
|
||||
w.l.Debug().Msg("container is already running")
|
||||
return nil
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithTimeout(w.task.Context(), w.cfg.WakeTimeout)
|
||||
ctx, cancel := context.WithTimeout(ctx, w.cfg.WakeTimeout)
|
||||
defer cancel()
|
||||
switch state.status {
|
||||
case idlewatcher.ContainerStatusStopped:
|
||||
|
||||
Reference in New Issue
Block a user