diff --git a/mcserver/zipsession_v2.py b/mcserver/zipsession_v2.py index 4892327..c8af8d0 100644 --- a/mcserver/zipsession_v2.py +++ b/mcserver/zipsession_v2.py @@ -335,11 +335,6 @@ def rmtree_with_retry(path, max_retries=5, backoff=0.1): try: shutil.rmtree(path) return - - except (PermissionError, OSError) as e: - if attempt == max_retries - 1: - raise - time.sleep(backoff * (2**attempt)) except FileNotFoundError as e: # In case we've made it here, we've made a best effort to delete @@ -348,6 +343,11 @@ def rmtree_with_retry(path, max_retries=5, backoff=0.1): return time.sleep(backoff * (2**attempt)) + except (PermissionError, OSError) as e: + if attempt == max_retries - 1: + raise + time.sleep(backoff * (2**attempt)) + def zipdir_contents_with_retry(dir_path, zip_path, max_retries=5, backoff=0.1): """ Given a source dir_path and a target zip_path, zip the folder with