Skip to content

Commit 045a190

Browse files
Merge pull request #16284 from vrothberg/fix-16076
notifyproxy: fix container watcher
2 parents 86f7b99 + c4ebe9e commit 045a190

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

pkg/systemd/notifyproxy/notifyproxy.go

+13-12
Original file line numberDiff line numberDiff line change
@@ -183,20 +183,21 @@ func (p *NotifyProxy) WaitAndClose() error {
183183
ctx, cancel := context.WithCancel(context.Background())
184184
defer cancel()
185185
go func() {
186-
select {
187-
case <-ctx.Done():
188-
return
189-
default:
190-
state, err := p.container.State()
191-
if err != nil {
192-
p.errorChan <- err
193-
return
194-
}
195-
if state != define.ContainerStateRunning {
196-
p.errorChan <- fmt.Errorf("%w: %s", ErrNoReadyMessage, p.container.ID())
186+
for {
187+
select {
188+
case <-ctx.Done():
197189
return
190+
case <-time.After(time.Second):
191+
state, err := p.container.State()
192+
if err != nil {
193+
p.errorChan <- err
194+
return
195+
}
196+
if state != define.ContainerStateRunning {
197+
p.errorChan <- fmt.Errorf("%w: %s", ErrNoReadyMessage, p.container.ID())
198+
return
199+
}
198200
}
199-
time.Sleep(time.Second)
200201
}
201202
}()
202203
}

0 commit comments

Comments
 (0)