From 648cb13e023e49af97f07f164a50f0e037ca20b1 Mon Sep 17 00:00:00 2001 From: Benjamin Sodenkamp <54522068+bensodenkamp@users.noreply.github.com> Date: Wed, 1 Jul 2020 14:29:45 -0700 Subject: [PATCH] Added 'close' to results channel in Walk() (#9956) --- cmd/gateway-main.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/gateway-main.go b/cmd/gateway-main.go index e0a3f6091..a33d8598a 100644 --- a/cmd/gateway-main.go +++ b/cmd/gateway-main.go @@ -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)