Skip to content

Commit 4443aa5

Browse files
Merge pull request #275 from stanfordnmbl/rmtree_with_retry-patch
patch rmtree_with_retry
2 parents 1e2237c + 7c75e7f commit 4443aa5

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

mcserver/zipsession_v2.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -335,11 +335,6 @@ def rmtree_with_retry(path, max_retries=5, backoff=0.1):
335335
try:
336336
shutil.rmtree(path)
337337
return
338-
339-
except (PermissionError, OSError) as e:
340-
if attempt == max_retries - 1:
341-
raise
342-
time.sleep(backoff * (2**attempt))
343338

344339
except FileNotFoundError as e:
345340
# 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):
348343
return
349344
time.sleep(backoff * (2**attempt))
350345

346+
except (PermissionError, OSError) as e:
347+
if attempt == max_retries - 1:
348+
raise
349+
time.sleep(backoff * (2**attempt))
350+
351351
def zipdir_contents_with_retry(dir_path, zip_path, max_retries=5, backoff=0.1):
352352
"""
353353
Given a source dir_path and a target zip_path, zip the folder with

0 commit comments

Comments
 (0)