Do not wait for results when canceled (#14607)

When canceled nobody may be listening for the results.

Prevents memory buildup from cancelled requests.
This commit is contained in:
Klaus Post
2022-03-22 09:37:01 -07:00
committed by GitHub
parent d796621ccc
commit 7bc1f986e8

View File

@@ -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) {