"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
yandex: fix 500 errors by waiting for uploads to complete before setting modtime
Nick Craig-Woodfe78b559d161
diff --git a/backend/yandex/api/types.go b/backend/yandex/api/types.goindex b1da038da..24c06514d 100644--- a/backend/yandex/api/types.go+++ b/backend/yandex/api/types.go@@ -52,9 +52,10 @@ type ResourceListResponse struct {// AsyncInfo struct is returned by the API for various async operations.type AsyncInfo struct {- HRef string `json:"href"`- Method string `json:"method"`- Templated bool `json:"templated"`+ HRef string `json:"href"`+ Method string `json:"method"`+ Templated bool `json:"templated"`+ OperationID string `json:"operation_id"`}// AsyncStatus is returned when requesting the status of an async operations. Possible values in-progress, success, failurediff --git a/backend/yandex/yandex.go b/backend/yandex/yandex.goindex 3edbfccd1..d767fd176 100644--- a/backend/yandex/yandex.go+++ b/backend/yandex/yandex.go@@ -577,7 +577,7 @@ func (f *Fs) waitForJob(ctx context.Context, location string) (err error) {}switch status.Status {- case "failure":+ case "failure", "failed":return fmt.Errorf("async operation returned %q", status.Status)case "success":return nil@@ -1124,6 +1124,14 @@ func (o *Object) upload(ctx context.Context, in io.Reader, overwrite bool, mimeTresp, err = o.fs.srv.Call(ctx, &opts)return shouldRetry(ctx, resp, err)})+ if err != nil {+ return err+ }++ // Wait for PUT to be committed+ if ur.OperationID != "" {+ err = o.fs.waitForJob(ctx, rootURL+"/operations/"+ur.OperationID)+ }return err}