From e6ab644350e795115e19e9bd974f234c52354ae8 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 11 Jun 2024 19:28:26 +0100 Subject: [PATCH] zoho: fix throttling problem when uploading files Before this change rclone checked to see if a file existed before uploading it. It did this to avoid making duplicate files. This involved listing the destination directory to see if the file existed which was rate limited by Zoho. However Zoho can't have duplicate files anyway so this fix just removes that check and the PutUnchecked method which isn't needed. See: https://forum.rclone.org/t/second-followup-on-the-older-topic-rclone-invokes-more-number-of-workdrive-s-files-listing-api-calls-which-exceeds-the-throttling-limit/45697 See: https://forum.rclone.org/t/followup-on-the-older-topic-rclone-invokes-more-number-of-workdrive-s-files-listing-api-calls-which-exceeds-the-throttling-limit/44794 --- backend/zoho/zoho.go | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/backend/zoho/zoho.go b/backend/zoho/zoho.go index 0eabc279e..b34e97064 100644 --- a/backend/zoho/zoho.go +++ b/backend/zoho/zoho.go @@ -639,24 +639,6 @@ func (f *Fs) createObject(ctx context.Context, remote string, size int64, modTim return } -// Put the object -// -// Copy the reader in to the new object which is returned. -// -// The new object may have been created if an error is returned -func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) { - existingObj, err := f.newObjectWithInfo(ctx, src.Remote(), nil) - switch err { - case nil: - return existingObj, existingObj.Update(ctx, in, src, options...) - case fs.ErrorObjectNotFound: - // Not found so create it - return f.PutUnchecked(ctx, in, src) - default: - return nil, err - } -} - func isSimpleName(s string) bool { for _, r := range s { if (r < 'a' || r > 'z') && (r < 'A' || r > 'Z') && (r != '.') { @@ -709,14 +691,12 @@ func (f *Fs) upload(ctx context.Context, name string, parent string, size int64, return info, nil } -// PutUnchecked the object into the container -// -// This will produce an error if the object already exists. +// Put the object into the container // // Copy the reader in to the new object which is returned. // // The new object may have been created if an error is returned -func (f *Fs) PutUnchecked(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) { +func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) { size := src.Size() remote := src.Remote()