mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
s3: avoid looping if the directory is empty
fix https://github.com/chrislusf/seaweedfs/issues/1701
This commit is contained in:
parent
1620de08ae
commit
8e48a235e2
|
@ -317,8 +317,10 @@ func (s3a *S3ApiServer) isDirectoryAllEmpty(filerClient filer_pb.SeaweedFilerCli
|
|||
currentDir := parentDir + "/" + name
|
||||
var startFrom string
|
||||
var isExhausted bool
|
||||
var foundEntry bool
|
||||
for fileCounter == 0 && !isExhausted && err == nil {
|
||||
err = filer_pb.SeaweedList(filerClient, currentDir, "", func(entry *filer_pb.Entry, isLast bool) error {
|
||||
foundEntry = true
|
||||
if entry.IsDirectory {
|
||||
subDirs = append(subDirs, entry.Name)
|
||||
} else {
|
||||
|
@ -329,6 +331,9 @@ func (s3a *S3ApiServer) isDirectoryAllEmpty(filerClient filer_pb.SeaweedFilerCli
|
|||
glog.V(4).Infof(" * %s/%s isLast: %t", currentDir, startFrom, isLast)
|
||||
return nil
|
||||
}, startFrom, false, 8)
|
||||
if !foundEntry {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue