Skip to content

Commit

Permalink
fix: filter context errors from log production (#2715)
Browse files Browse the repository at this point in the history
Don't return context errors from log production as it's confusing to
callers which cancel, making it harder to understand any actual errors
that occurred.
  • Loading branch information
stevenh authored Aug 9, 2024
1 parent dbc0ba9 commit 3c326f8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,16 @@ func (c *DockerContainer) stopLogProduction() error {

c.logProductionWaitGroup.Wait()

return <-c.logProductionError
if err := <-c.logProductionError; err != nil {
if errors.Is(err, context.DeadlineExceeded) || errors.Is(err, context.Canceled) {
// Returning context errors is not useful for the consumer.
return nil
}

return err
}

return nil
}

// GetLogProductionErrorChannel exposes the only way for the consumer
Expand Down

0 comments on commit 3c326f8

Please sign in to comment.