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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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