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

master
Benjamin Sodenkamp 4 years ago committed by GitHub
parent 174f428571
commit 648cb13e02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      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 { 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 { walk := func(ctx context.Context, bucket, prefix string, results chan<- ObjectInfo) error {
var marker string var marker string
// Make sure the results channel is ready to be read when we're done.
defer close(results)
for { for {
// set maxKeys to '0' to list maximum possible objects in single call. // set maxKeys to '0' to list maximum possible objects in single call.
loi, err := l.ObjectLayer.ListObjects(ctx, bucket, prefix, marker, "", 0) loi, err := l.ObjectLayer.ListObjects(ctx, bucket, prefix, marker, "", 0)

Loading…
Cancel
Save