diff --git a/cmd/metacache-set.go b/cmd/metacache-set.go index eb96c44a2..7b0473f48 100644 --- a/cmd/metacache-set.go +++ b/cmd/metacache-set.go @@ -189,7 +189,11 @@ func (o *listPathOptions) gatherResults(ctx context.Context, in <-chan metaCache } if resCh != nil { resErr = io.EOF - resCh <- results + select { + case <-ctx.Done(): + // Nobody wants it. + case resCh <- results: + } } }() return func() (metaCacheEntriesSorted, error) {