Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

box: add --box-list-chunk to control listing chunk size #5545

Nick Craig-Woodb61912b4c88f
diff --git a/backend/box/box.go b/backend/box/box.go
index ad4968496..f90078d0d 100644
--- a/backend/box/box.go
+++ b/backend/box/box.go
@@ -56,7 +56,6 @@ const (
decayConstant = 2 // bigger for slower decay, exponential
rootURL = "https://api.box.com/2.0"
uploadURL = "https://upload.box.com/api/2.0"
- listChunks = 1000 // chunk size to read directory listings
minUploadCutoff = 50000000 // upload cutoff can be no lower than this
defaultUploadCutoff = 50 * 1024 * 1024
tokenURL = "https://api.box.com/oauth2/token"
@@ -133,6 +132,11 @@ func init() {
Help: "Max number of times to try committing a multipart file.",
Default: 100,
Advanced: true,
+ }, {
+ Name: "list_chunk",
+ Default: 1000,
+ Help: "Size of listing chunk 1-1000.",
+ Advanced: true,
}, {
Name: config.ConfigEncoding,
Help: config.ConfigEncodingHelp,
@@ -247,6 +251,7 @@ type Options struct {
Enc encoder.MultiEncoder `config:"encoding"`
RootFolderID string `config:"root_folder_id"`
AccessToken string `config:"access_token"`
+ ListChunk int `config:"list_chunk"`
}
// Fs represents a remote box
@@ -577,7 +582,7 @@ func (f *Fs) listAll(ctx context.Context, dirID string, directoriesOnly bool, fi
Path: "/folders/" + dirID + "/items",
Parameters: fieldsValue(),
}
- opts.Parameters.Set("limit", strconv.Itoa(listChunks))
+ opts.Parameters.Set("limit", strconv.Itoa(f.opt.ListChunk))
opts.Parameters.Set("usemarker", "true")
var marker *string
OUTER:
@@ -1103,7 +1108,7 @@ func (f *Fs) CleanUp(ctx context.Context) (err error) {
"fields": []string{"type", "id"},
},
}
- opts.Parameters.Set("limit", strconv.Itoa(listChunks))
+ opts.Parameters.Set("limit", strconv.Itoa(f.opt.ListChunk))
opts.Parameters.Set("usemarker", "true")
var marker *string
for {