Prevent 500 errors on file move race condition.

- Legacy-Id: 8480
This commit is contained in:
Henrik Levkowetz 2014-10-26 13:19:38 +00:00
parent 42fe537b81
commit 5a6819832f

View file

@ -114,7 +114,13 @@ def move_draft_files_to_archive(doc, rev):
dst = os.path.join(settings.INTERNET_DRAFT_ARCHIVE_DIR, f)
if os.path.exists(src):
shutil.move(src, dst)
try:
shutil.move(src, dst)
except IOError as e:
if "No such file or directory" in str(e):
pass
else:
raise
src_dir = Path(settings.INTERNET_DRAFT_PATH)
for file in src_dir.glob("%s-%s.*" % (doc.name, rev)):