mirror of
https://github.com/docker/compose.git
synced 2025-07-21 12:44:54 +02:00
monitor must watch events even when context is cancelled
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
17ba6c7188
commit
f35d2cfb3b
@ -79,7 +79,7 @@ func (c *monitor) Start(ctx context.Context) error {
|
||||
}
|
||||
restarting := utils.Set[string]{}
|
||||
|
||||
evtCh, errCh := c.api.Events(ctx, events.ListOptions{
|
||||
evtCh, errCh := c.api.Events(context.Background(), events.ListOptions{
|
||||
Filters: filters.NewArgs(
|
||||
filters.Arg("type", "container"),
|
||||
projectFilter(c.project)),
|
||||
@ -89,8 +89,6 @@ func (c *monitor) Start(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return nil
|
||||
case err := <-errCh:
|
||||
return err
|
||||
case event := <-evtCh:
|
||||
|
@ -111,6 +111,7 @@ func (s *composeService) Up(ctx context.Context, project *types.Project, options
|
||||
eg.Go(func() error {
|
||||
first := true
|
||||
gracefulTeardown := func() {
|
||||
first = false
|
||||
tui.ApplicationTermination()
|
||||
eg.Go(func() error {
|
||||
return progress.RunWithLog(context.WithoutCancel(ctx), func(ctx context.Context) error {
|
||||
@ -121,7 +122,6 @@ func (s *composeService) Up(ctx context.Context, project *types.Project, options
|
||||
}, s.stdinfo(), logConsumer)
|
||||
})
|
||||
isTerminated.Store(true)
|
||||
first = false
|
||||
}
|
||||
|
||||
for {
|
||||
@ -238,7 +238,7 @@ func (s *composeService) Up(ctx context.Context, project *types.Project, options
|
||||
})
|
||||
|
||||
eg.Go(func() error {
|
||||
err := monitor.Start(ctx)
|
||||
err := monitor.Start(context.Background())
|
||||
// Signal for the signal-handler goroutines to stop
|
||||
close(doneCh)
|
||||
return err
|
||||
|
Loading…
x
Reference in New Issue
Block a user