mirror of
https://github.com/rclone/rclone.git
synced 2024-11-23 22:35:53 +08:00
acd: After moving a file, wait for the file to no longer be in the directory
This fixes a Move followed quickly by a Copy updating the wrong file.
This commit is contained in:
parent
a4bf22e620
commit
e9da14ac2e
|
@ -666,6 +666,18 @@ func (f *Fs) Move(src fs.Object, remote string) (fs.Object, error) {
|
||||||
remote: remote,
|
remote: remote,
|
||||||
info: dstInfo,
|
info: dstInfo,
|
||||||
}
|
}
|
||||||
|
// Wait for directory caching so we can no longer see the old object
|
||||||
|
time.Sleep(200 * time.Millisecond) // enough time 90% of the time
|
||||||
|
for i := 1; i <= fs.Config.LowLevelRetries; i++ {
|
||||||
|
_, err := srcObj.fs.NewObject(srcObj.remote) // try reading the object
|
||||||
|
if err == fs.ErrorObjectNotFound {
|
||||||
|
break
|
||||||
|
} else if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
fs.Debug(src, "Wait for directory listing to update after move %d/%d", i, fs.Config.LowLevelRetries)
|
||||||
|
time.Sleep(1 * time.Second)
|
||||||
|
}
|
||||||
return dstObj, nil
|
return dstObj, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user