Fix temp file deletion

This commit is contained in:
Weves
2023-11-29 01:52:30 -08:00
committed by Chris Weaver
parent c2727a3f19
commit c64c25b2e1

View File

@@ -208,8 +208,10 @@ def clean_old_temp_files_task(
Currently handled async of the indexing job""" Currently handled async of the indexing job"""
os.makedirs(base_path, exist_ok=True) os.makedirs(base_path, exist_ok=True)
for file in os.listdir(base_path): for file in os.listdir(base_path):
if file_age_in_hours(file) > age_threshold_in_hours: full_file_path = Path(base_path) / file
os.remove(Path(base_path) / file) if file_age_in_hours(full_file_path) > age_threshold_in_hours:
logger.info(f"Cleaning up uploaded file: {full_file_path}")
os.remove(full_file_path)
##### #####