Merge "Log unexpected errors when trying to clean up empty dirs"
This commit is contained in:
commit
4c2ef69d31
@ -1060,8 +1060,12 @@ class BaseDiskFileManager(object):
|
|||||||
if not files: # everything got unlinked
|
if not files: # everything got unlinked
|
||||||
try:
|
try:
|
||||||
os.rmdir(hsh_path)
|
os.rmdir(hsh_path)
|
||||||
except OSError:
|
except OSError as err:
|
||||||
pass
|
if err.errno not in (errno.ENOENT, errno.ENOTEMPTY):
|
||||||
|
self.logger.debug(
|
||||||
|
'Error cleaning up empty hash directory %s: %s',
|
||||||
|
hsh_path, err)
|
||||||
|
# else, no real harm; pass
|
||||||
return results
|
return results
|
||||||
|
|
||||||
def _update_suffix_hashes(self, hashes, ondisk_info):
|
def _update_suffix_hashes(self, hashes, ondisk_info):
|
||||||
@ -1560,12 +1564,15 @@ class BaseDiskFileManager(object):
|
|||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
os.rmdir(suffix_path)
|
os.rmdir(suffix_path)
|
||||||
except OSError:
|
except OSError as err:
|
||||||
|
if err.errno not in (errno.ENOENT, errno.ENOTEMPTY):
|
||||||
|
self.logger.debug(
|
||||||
|
'Error cleaning up empty suffix directory %s: %s',
|
||||||
|
suffix_path, err)
|
||||||
# cleanup_ondisk_files tries to remove empty hash dirs,
|
# cleanup_ondisk_files tries to remove empty hash dirs,
|
||||||
# but if it fails, so will we. An empty directory
|
# but if it fails, so will we. An empty directory
|
||||||
# structure won't cause errors (just slowdown), so we
|
# structure won't cause errors (just slowdown), so we
|
||||||
# ignore the exception.
|
# ignore the exception.
|
||||||
pass
|
|
||||||
if considering_all_suffixes and not have_nonempty_suffix:
|
if considering_all_suffixes and not have_nonempty_suffix:
|
||||||
# There's nothing of interest in the partition, so delete it
|
# There's nothing of interest in the partition, so delete it
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user