"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
ftp: add a small pause after failed upload before deleting file #2517
Nick Craig-Woodc473c7cb5318
diff --git a/backend/ftp/ftp.go b/backend/ftp/ftp.goindex 21b7f5e71..fafe6b702 100644--- a/backend/ftp/ftp.go+++ b/backend/ftp/ftp.go@@ -704,6 +704,11 @@ func (o *Object) Update(in io.Reader, src fs.ObjectInfo, options ...fs.OpenOptiopath := path.Join(o.fs.root, o.remote)// remove the file if upload failedremove := func() {+ // Give the FTP server a chance to get its internal state in order after the error.+ // The error may have been local in which case we closed the connection. The server+ // may still be dealing with it for a moment. A sleep isn't ideal but I haven't been+ // able to think of a better method to find out if the server has finished - ncw+ time.Sleep(1 * time.Second)removeErr := o.Remove()if removeErr != nil {fs.Debugf(o, "Failed to remove: %v", removeErr)@@ -717,7 +722,7 @@ func (o *Object) Update(in io.Reader, src fs.ObjectInfo, options ...fs.OpenOptio}err = c.Stor(path, in)if err != nil {- _ = c.Quit()+ _ = c.Quit() // toss this connection to avoid sync errorsremove()return errors.Wrap(err, "update stor")}