Skip to content

Commit

Permalink
Ingore errors removing "process before description" files
Browse files Browse the repository at this point in the history
  • Loading branch information
ffont committed Nov 16, 2023
1 parent f81e3de commit 3e9b353
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions utils/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def crc32file(filename):
return hex(crc32)[2:]


def remove_directory(path):
shutil.rmtree(path)
def remove_directory(path, ignore_errors=False):
shutil.rmtree(path, ignore_errors=ignore_errors)


def remove_directory_if_empty(path):
Expand Down
9 changes: 8 additions & 1 deletion utils/sound_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,14 @@ def _remove_user_uploads_folder_if_empty(user):
def clean_processing_before_describe_files(audio_file_path):
directory_path = get_processing_before_describe_sound_folder(audio_file_path)
if os.path.exists(directory_path):
remove_directory(directory_path)
# Note we use ignore_errors=True below because we've found issues with remove_directory similar
# to those described here https://github.com/ansible/ansible/issues/34335 (sort of race confitions)
# We suspect these errors can happen if the user describes the sound before it has finished "processing
# before description" (maybe the case of long sounds?). In that case the directory will be removed while
# new sounds are being added to it. If this happens, the error will be ignored and the folder will not be
# removed at this time. Nevertheless an async job that cleans old unnecessary folders form the data volume
# will eventually identify this folder and remove it later.
remove_directory(directory_path, ignore_errors=True)


def get_duration_from_processing_before_describe_files(audio_file_path):
Expand Down

0 comments on commit 3e9b353

Please sign in to comment.