logfile: Close reader when caller cancels

This allows for an individual decode operation to be cancelled while the
log reader is reading data from a log file by closing the underlying file.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
Brian Goff
2024-07-22 18:53:48 +00:00
parent dbf6873f45
commit 9b6ba18fc9
3 changed files with 13 additions and 11 deletions

View File

@@ -27,9 +27,7 @@ import (
func (daemon *Daemon) ContainerLogs(ctx context.Context, containerName string, config *containertypes.LogsOptions) (messages <-chan *backend.LogMessage, isTTY bool, retErr error) {
ctx, span := tracing.StartSpan(ctx, "daemon.ContainerLogs")
defer func() {
if retErr != nil {
span.SetStatus(retErr)
}
span.SetStatus(retErr)
span.End()
}()