"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
Read folders in separate goroutines.
Klaus Posta1a780e84765
diff --git a/amazonclouddrive/amazonclouddrive.go b/amazonclouddrive/amazonclouddrive.goindex f8454005c..378e227d9 100644--- a/amazonclouddrive/amazonclouddrive.go+++ b/amazonclouddrive/amazonclouddrive.go@@ -28,6 +28,7 @@ import ("github.com/ncw/rclone/oauthutil""github.com/ncw/rclone/pacer""golang.org/x/oauth2"+ "sync")const (@@ -353,16 +354,23 @@ OUTER:func (f *FsAcd) listDirRecursive(dirId string, path string, out fs.ObjectsChan) error {var subError error// Make the API request+ var wg sync.WaitGroup_, err := f.listAll(dirId, "", false, false, func(node *acd.Node) bool {// Recurse on directories- // FIXME should do this in parallel- // use a wg to sync then collect errorswitch *node.Kind {case folderKind:- subError = f.listDirRecursive(*node.Id, path+*node.Name+"/", out)- if subError != nil {- return true- }+ wg.Add(1)+ folder := path + *node.Name + "/"+ fs.Debug(f, "Reading %s", folder)+ go func() {+ defer wg.Done()+ err := f.listDirRecursive(*node.Id, folder, out)+ if err != nil {+ subError = err+ fs.ErrorLog(f, "Error reading %s:%s", folder, err)+ }+ }()+ return falsecase fileKind:if fs := f.newFsObjectWithInfo(path+*node.Name, node); fs != nil {out <- fs@@ -372,6 +380,8 @@ func (f *FsAcd) listDirRecursive(dirId string, path string, out fs.ObjectsChan)}return false})+ wg.Wait()+ fs.Debug(f, "Finished reading %s", path)if err != nil {return err}