Skip to content

Commit dec608f

Browse files
committed
don't block events loop collecting logs
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent eb0632b commit dec608f

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

pkg/compose/logs.go

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -96,18 +96,21 @@ func (s *composeService) Logs(
9696
ID: c.ID,
9797
Service: c.Labels[api.ServiceLabel],
9898
})
99-
err := s.logContainers(ctx, consumer, c, api.LogOptions{
100-
Follow: options.Follow,
101-
Since: t.Format(time.RFC3339Nano),
102-
Until: options.Until,
103-
Tail: options.Tail,
104-
Timestamps: options.Timestamps,
99+
eg.Go(func() error {
100+
err := s.logContainers(ctx, consumer, c, api.LogOptions{
101+
Follow: options.Follow,
102+
Since: t.Format(time.RFC3339Nano),
103+
Until: options.Until,
104+
Tail: options.Tail,
105+
Timestamps: options.Timestamps,
106+
})
107+
if _, ok := err.(errdefs.ErrNotImplemented); ok {
108+
// ignore
109+
return nil
110+
}
111+
return err
105112
})
106-
if _, ok := err.(errdefs.ErrNotImplemented); ok {
107-
// ignore
108-
return nil
109-
}
110-
return err
113+
return nil
111114
}, func(c types.Container, t time.Time) error {
112115
printer.HandleEvent(api.ContainerEvent{
113116
Type: api.ContainerEventAttach,

0 commit comments

Comments
 (0)