From ef994386957705b137f0ba61c12f0414d985a17e Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Thu, 17 Jun 2021 08:16:31 -0700 Subject: [PATCH] fs: Return faster on no ListObjects results (#12525) When no results are sent `result.end` is never sent, so the list becomes hot until the list is full. Break immediately when channel is closed. Fixes #12518 --- cmd/object-api-common.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/object-api-common.go b/cmd/object-api-common.go index 99bda79ad..bed1c3014 100644 --- a/cmd/object-api-common.go +++ b/cmd/object-api-common.go @@ -22,7 +22,7 @@ import ( "strings" "sync" - humanize "github.com/dustin/go-humanize" + "github.com/dustin/go-humanize" "github.com/minio/minio/internal/sync/errgroup" ) @@ -289,6 +289,7 @@ func listObjects(ctx context.Context, obj ObjectLayer, bucket, prefix, marker, d if !ok { // Closed channel. eof = true + break } if HasSuffix(walkResult.entry, SlashSeparator) {