Closed efiop closed 2 months ago
@mederka In that case they will both download stuff to a temporary location but then one of them will get an error that a file exists on a final os.rename
, but that could've happened before too with shutil.move
. What matters here is that files and repos data is guaranteed to be intact. If user logic relies on particular path then it should be able to handle EEXIST
error themselves.
@badayvedat I've added a prefix, so that the files/dirs look like this: myfile.txt.tmpm_avlu_x
mydir.tmplqxoo8ek
, so you know what is being downloaded.
Make sure our files/directories are created in a temporary location that is on the same filesystem as the target to avoid unnecessary copies across filesystems and to make it possible to (semi)atomically move them into place using
os.rename
.I don't have good examples yet, but this might make some of our apps faster because they used to clone to tempfs but then shutil.move (which copies across fs) to a data fs. Obviously for that the apps would need to be redeployed.