"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
dropbox,ftp,onedrive,yandex: make --timeout 0 work properly
Nick Craig-Wood0ad38dd6fa28
diff --git a/backend/dropbox/dropbox.go b/backend/dropbox/dropbox.goindex 456c7cc69..31008ae76 100755--- a/backend/dropbox/dropbox.go+++ b/backend/dropbox/dropbox.go@@ -1269,7 +1269,7 @@ func (f *Fs) changeNotifyRunner(ctx context.Context, notifyFunc func(string, fs.var res *files.ListFolderLongpollResult// Dropbox sets a timeout range of 30 - 480- timeout := uint64(f.ci.Timeout / time.Second)+ timeout := uint64(f.ci.TimeoutOrInfinite() / time.Second)if timeout > 480 {timeout = 480}diff --git a/backend/ftp/ftp.go b/backend/ftp/ftp.goindex 62e9784ed..b7c7650ce 100644--- a/backend/ftp/ftp.go+++ b/backend/ftp/ftp.go@@ -598,7 +598,7 @@ func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err e}()// Wait for List for up to Timeout seconds- timer := time.NewTimer(f.ci.Timeout)+ timer := time.NewTimer(f.ci.TimeoutOrInfinite())select {case listErr = <-errchan:timer.Stop()diff --git a/backend/onedrive/onedrive.go b/backend/onedrive/onedrive.goindex e0523b454..06817fce5 100755--- a/backend/onedrive/onedrive.go+++ b/backend/onedrive/onedrive.go@@ -1088,7 +1088,7 @@ func (f *Fs) Precision() time.Duration {// waitForJob waits for the job with status in url to completefunc (f *Fs) waitForJob(ctx context.Context, location string, o *Object) error {- deadline := time.Now().Add(f.ci.Timeout)+ deadline := time.Now().Add(f.ci.TimeoutOrInfinite())for time.Now().Before(deadline) {var resp *http.Responsevar err error@@ -1126,7 +1126,7 @@ func (f *Fs) waitForJob(ctx context.Context, location string, o *Object) error {time.Sleep(1 * time.Second)}- return errors.Errorf("async operation didn't complete after %v", f.ci.Timeout)+ return errors.Errorf("async operation didn't complete after %v", f.ci.TimeoutOrInfinite())}// Copy src to this remote using server-side copy operations.diff --git a/backend/yandex/yandex.go b/backend/yandex/yandex.goindex 191ed83b9..1ad22f784 100644--- a/backend/yandex/yandex.go+++ b/backend/yandex/yandex.go@@ -537,7 +537,7 @@ func (f *Fs) waitForJob(ctx context.Context, location string) (err error) {RootURL: location,Method: "GET",}- deadline := time.Now().Add(f.ci.Timeout)+ deadline := time.Now().Add(f.ci.TimeoutOrInfinite())for time.Now().Before(deadline) {var resp *http.Responsevar body []byte@@ -568,7 +568,7 @@ func (f *Fs) waitForJob(ctx context.Context, location string) (err error) {time.Sleep(1 * time.Second)}- return errors.Errorf("async operation didn't complete after %v", f.ci.Timeout)+ return errors.Errorf("async operation didn't complete after %v", f.ci.TimeoutOrInfinite())}func (f *Fs) delete(ctx context.Context, path string, hardDelete bool) (err error) {diff --git a/fs/config.go b/fs/config.goindex fa7198e3b..939cfd660 100644--- a/fs/config.go+++ b/fs/config.go@@ -164,6 +164,14 @@ func NewConfig() *ConfigInfo {return c}+// TimeoutOrInfinite returns ci.Timeout if > 0 or infinite otherwise+func (c *ConfigInfo) TimeoutOrInfinite() time.Duration {+ if c.Timeout > 0 {+ return c.Timeout+ }+ return ModTimeNotSupported+}+type configContextKeyType struct{}// Context key for config