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

webdav: add a small pause after failed upload before deleting file #2517

Nick Craig-Woodd27630626a51
diff --git a/backend/webdav/webdav.go b/backend/webdav/webdav.go
index 25721a9c2..187ddad23 100644
--- a/backend/webdav/webdav.go
+++ b/backend/webdav/webdav.go
@@ -968,6 +968,12 @@ func (o *Object) Update(in io.Reader, src fs.ObjectInfo, options ...fs.OpenOptio
return shouldRetry(resp, err)
})
if err != nil {
+ // Give the WebDAV 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)
// Remove failed upload
_ = o.Remove()
return err