deleter.py: delete boot and crash folders last (#21028)

pull/21100/head
Willem Melching 4 years ago committed by GitHub
parent 07e4129edc
commit 129c760e4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      selfdrive/loggerd/deleter.py

@ -9,6 +9,8 @@ from selfdrive.loggerd.uploader import listdir_by_creation
MIN_BYTES = 5 * 1024 * 1024 * 1024
MIN_PERCENT = 10
DELETE_LAST = ['boot', 'crash']
def deleter_thread(exit_event):
while not exit_event.is_set():
@ -17,7 +19,7 @@ def deleter_thread(exit_event):
if out_of_percent or out_of_bytes:
# remove the earliest directory we can
dirs = listdir_by_creation(ROOT)
dirs = sorted(listdir_by_creation(ROOT), key=lambda x: x in DELETE_LAST)
for delete_dir in dirs:
delete_path = os.path.join(ROOT, delete_dir)

Loading…
Cancel
Save