Merge pull request #16284 from vrothberg/fix-16076
notifyproxy: fix container watcher
This commit is contained in:
commit
045a190c33
|
|
@ -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
|
||||
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
|
||||
}
|
||||
}
|
||||
if state != define.ContainerStateRunning {
|
||||
p.errorChan <- fmt.Errorf("%w: %s", ErrNoReadyMessage, p.container.ID())
|
||||
return
|
||||
}
|
||||
time.Sleep(time.Second)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue