"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
zoho: retry reading info if size wasn't returned
Nick Craig-Wood00f0e9df9dd2
diff --git a/backend/zoho/zoho.go b/backend/zoho/zoho.goindex b34e97064..dcac9adc1 100644--- a/backend/zoho/zoho.go+++ b/backend/zoho/zoho.go@@ -332,7 +332,7 @@ func parsePath(path string) (root string) {// readMetaDataForPath reads the metadata from the pathfunc (f *Fs) readMetaDataForPath(ctx context.Context, path string) (info *api.Item, err error) {- // defer fs.Trace(f, "path=%q", path)("info=%+v, err=%v", &info, &err)+ // defer log.Trace(f, "path=%q", path)("info=%+v, err=%v", &info, &err)leaf, directoryID, err := f.dirCache.FindPath(ctx, path, false)if err != nil {if err == fs.ErrorDirNotFound {@@ -683,9 +683,21 @@ func (f *Fs) upload(ctx context.Context, name string, parent string, size int64,return nil, errors.New("upload: invalid response")}// Received meta data is missing size so we have to read it again.- info, err := f.readMetaDataForID(ctx, uploadResponse.Uploads[0].Attributes.RessourceID)- if err != nil {- return nil, err+ // It doesn't always appear on first read so try again if necessary+ var info *api.Item+ const maxTries = 10+ sleepTime := 100 * time.Millisecond+ for i := 0; i < maxTries; i++ {+ info, err = f.readMetaDataForID(ctx, uploadResponse.Uploads[0].Attributes.RessourceID)+ if err != nil {+ return nil, err+ }+ if info.Attributes.StorageInfo.Size != 0 || size == 0 {+ break+ }+ fs.Debugf(f, "Size not available yet for %q - try again in %v (try %d/%d)", name, sleepTime, i+1, maxTries)+ time.Sleep(sleepTime)+ sleepTime *= 2}return info, nil