internxt: fix server-side directory move failing after a gateway timeout
Moving a directory can take longer than the API gateway allows, so the request fails with a 520 or 502 error even though the move completes. The retry then failed with "Folder ... was already moved to that location (status 409)". Treat that error as success.
This commit is contained in:
1 parent
7ff5da8517
commit
0c52b183d0
1 file changed
+5
@@ -1033,6 +1033,11 @@ func (f *Fs) DirMove(ctx context.Context, src fs.Fs, srcRemote, dstRemote string
|
||||
encodedLeaf := f.opt.Encoding.FromStandardName(dstLeaf)
|
||||
err = f.pacer.Call(func() (bool, error) {
|
||||
err := folders.MoveFolder(ctx, f.cfg, srcID, dstDirectoryID, encodedLeaf)
|
||||
// Moving a large folder can outlast the gateway timeout (520/502)
|
||||
// yet still complete, in which case the retry reports this.
|
||||
if err != nil && isConflictError(err) && strings.Contains(err.Error(), "already moved to that location") {
|
||||
return false, nil
|
||||
}
|
||||
return f.shouldRetry(ctx, err)
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user