Added 'close' to results channel in Walk() (#9956)

This commit is contained in:
Benjamin Sodenkamp 2020-07-01 14:29:45 -07:00 committed by GitHub
parent 174f428571
commit 648cb13e02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,6 +60,10 @@ func (l *GatewayLocker) NewNSLock(ctx context.Context, bucket string, objects ..
func (l *GatewayLocker) Walk(ctx context.Context, bucket, prefix string, results chan<- ObjectInfo) error {
walk := func(ctx context.Context, bucket, prefix string, results chan<- ObjectInfo) error {
var marker string
// Make sure the results channel is ready to be read when we're done.
defer close(results)
for {
// set maxKeys to '0' to list maximum possible objects in single call.
loi, err := l.ObjectLayer.ListObjects(ctx, bucket, prefix, marker, "", 0)