Bugfix attempt: When a file disappears before its ctime can be checked, don't let the whole program crash

This commit is contained in:
server 2024-09-29 20:13:10 -07:00 committed by mike
parent 565c1d31b9
commit 161f018cb9
2 changed files with 8 additions and 1 deletions

View File

@ -326,7 +326,12 @@ class BackupRotator:
best_ctime = None
for item in items:
try:
ctime = Util.detect_item_creation_date(config, item)
except FileNotFoundError as e:
self.__logger.error(f"File disappeared while trying to check ctime: {item}")
continue
if best_ctime is None or ctime < best_ctime:
best_ctime = ctime
best_item = item

View File

@ -42,6 +42,8 @@ class Util:
# print("got mtime")
stat = item.stat().st_birthtime
# print("got btime")
except FileNotFoundError as e:
raise e
except AttributeError:
pass