mirror of
https://github.com/docker/compose.git
synced 2025-07-23 05:34:36 +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]{}
|
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: filters.NewArgs(
|
||||||
filters.Arg("type", "container"),
|
filters.Arg("type", "container"),
|
||||||
projectFilter(c.project)),
|
projectFilter(c.project)),
|
||||||
@ -89,8 +89,6 @@ func (c *monitor) Start(ctx context.Context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
|
||||||
return nil
|
|
||||||
case err := <-errCh:
|
case err := <-errCh:
|
||||||
return err
|
return err
|
||||||
case event := <-evtCh:
|
case event := <-evtCh:
|
||||||
|
@ -111,6 +111,7 @@ func (s *composeService) Up(ctx context.Context, project *types.Project, options
|
|||||||
eg.Go(func() error {
|
eg.Go(func() error {
|
||||||
first := true
|
first := true
|
||||||
gracefulTeardown := func() {
|
gracefulTeardown := func() {
|
||||||
|
first = false
|
||||||
tui.ApplicationTermination()
|
tui.ApplicationTermination()
|
||||||
eg.Go(func() error {
|
eg.Go(func() error {
|
||||||
return progress.RunWithLog(context.WithoutCancel(ctx), func(ctx context.Context) 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)
|
}, s.stdinfo(), logConsumer)
|
||||||
})
|
})
|
||||||
isTerminated.Store(true)
|
isTerminated.Store(true)
|
||||||
first = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
@ -238,7 +238,7 @@ func (s *composeService) Up(ctx context.Context, project *types.Project, options
|
|||||||
})
|
})
|
||||||
|
|
||||||
eg.Go(func() error {
|
eg.Go(func() error {
|
||||||
err := monitor.Start(ctx)
|
err := monitor.Start(context.Background())
|
||||||
// Signal for the signal-handler goroutines to stop
|
// Signal for the signal-handler goroutines to stop
|
||||||
close(doneCh)
|
close(doneCh)
|
||||||
return err
|
return err
|
||||||
|
Loading…
x
Reference in New Issue
Block a user