Also keep 10% free so 64gb/128gb EON will still engage when full

old-commit-hash: de6d73599bc0b57688870b3d16d87dff47dff7f3
This commit is contained in:
Willem Melching
2020-02-10 18:35:10 -08:00
parent b26d45ce04
commit d61e1e287c

View File

@@ -3,15 +3,19 @@ import os
import shutil
import threading
from selfdrive.swaglog import cloudlog
from selfdrive.loggerd.config import ROOT, get_available_bytes
from selfdrive.loggerd.config import ROOT, get_available_bytes, get_available_percent
from selfdrive.loggerd.uploader import listdir_by_creation
MIN_BYTES = 5 * 1024 * 1024 * 1024
MIN_PERCENT = 10
def deleter_thread(exit_event):
while not exit_event.is_set():
available_bytes = get_available_bytes()
out_of_bytes = get_available_bytes(default=MIN_BYTES + 1) < MIN_BYTES
out_of_percent = get_available_percent(default=MIN_PERCENT + 1) < MIN_PERCENT
if available_bytes is not None and available_bytes < (5 * 1024 * 1024 * 1024):
if out_of_percent or out_of_bytes:
# remove the earliest directory we can
dirs = listdir_by_creation(ROOT)
for delete_dir in dirs: