Skip to content

Commit

Permalink
Merge pull request #16284 from vrothberg/fix-16076
Browse files Browse the repository at this point in the history
notifyproxy: fix container watcher
  • Loading branch information
openshift-merge-robot authored Oct 25, 2022
2 parents 86f7b99 + c4ebe9e commit 045a190
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions pkg/systemd/notifyproxy/notifyproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,20 +183,21 @@ func (p *NotifyProxy) WaitAndClose() error {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
go func() {
select {
case <-ctx.Done():
return
default:
state, err := p.container.State()
if err != nil {
p.errorChan <- err
return
}
if state != define.ContainerStateRunning {
p.errorChan <- fmt.Errorf("%w: %s", ErrNoReadyMessage, p.container.ID())
for {
select {
case <-ctx.Done():
return
case <-time.After(time.Second):
state, err := p.container.State()
if err != nil {
p.errorChan <- err
return
}
if state != define.ContainerStateRunning {
p.errorChan <- fmt.Errorf("%w: %s", ErrNoReadyMessage, p.container.ID())
return
}
}
time.Sleep(time.Second)
}
}()
}
Expand Down

0 comments on commit 045a190

Please sign in to comment.