Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

avoid tiny step pagination

Chris Ludd176cdb8bf5
diff --git a/weed/filer2/filerstore.go b/weed/filer2/filerstore.go
index f368e119dd..dd5abe4214 100644
--- a/weed/filer2/filerstore.go
+++ b/weed/filer2/filerstore.go
@@ -176,10 +176,13 @@ func (fsw *FilerStoreWrapper) prefixFilterEntries(ctx context.Context, dirPath u
if strings.HasPrefix(entry.Name(), prefix) {
count++
entries = append(entries, entry)
+ if count >= limit {
+ break
+ }
}
}
if count < limit {
- notPrefixed, err = fsw.ActualStore.ListDirectoryEntries(ctx, dirPath, lastFileName, false, limit-count)
+ notPrefixed, err = fsw.ActualStore.ListDirectoryEntries(ctx, dirPath, lastFileName, false, limit)
if err != nil {
return
}