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

drive: Add missing retries for Move and DirMove

Nick Craig-Woodfdd4b4ee220a
diff --git a/drive/drive.go b/drive/drive.go
index 731db09fe..5c388adcb 100644
--- a/drive/drive.go
+++ b/drive/drive.go
@@ -772,7 +772,11 @@ func (f *Fs) Move(src fs.Object, remote string) (fs.Object, error) {
}
// Do the move
- info, err := f.svc.Files.Patch(srcObj.id, dstInfo).SetModifiedDate(true).Do()
+ var info *drive.File
+ err = f.pacer.Call(func() (bool, error) {
+ info, err = f.svc.Files.Patch(srcObj.id, dstInfo).SetModifiedDate(true).Do()
+ return shouldRetry(err)
+ })
if err != nil {
return nil, err
}
@@ -814,7 +818,10 @@ func (f *Fs) DirMove(src fs.Fs) error {
Title: leaf,
Parents: []*drive.ParentReference{{Id: directoryID}},
}
- _, err = f.svc.Files.Patch(srcFs.dirCache.RootID(), &patch).Do()
+ err = f.pacer.Call(func() (bool, error) {
+ _, err = f.svc.Files.Patch(srcFs.dirCache.RootID(), &patch).Do()
+ return shouldRetry(err)
+ })
if err != nil {
return err
}