return files clearded from clear_dl_cache

This commit is contained in:
simon 2023-02-02 10:46:59 +07:00
parent d73a131616
commit 83057d9e54
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
2 changed files with 5 additions and 2 deletions

View File

@ -122,10 +122,13 @@ def clear_dl_cache(config):
"""clear leftover files from dl cache"""
print("clear download cache")
cache_dir = os.path.join(config["application"]["cache_dir"], "download")
for cached in os.listdir(cache_dir):
leftover_files = os.listdir(cache_dir)
for cached in leftover_files:
to_delete = os.path.join(cache_dir, cached)
os.remove(to_delete)
return len(leftover_files)
def get_mapping():
"""read index_mapping.json and get expected mapping and settings"""

View File

@ -228,7 +228,7 @@ def kill_dl(task_id):
_ = RedisArchivist().del_message("dl_queue_id")
RedisQueue(queue_name="dl_queue").clear()
clear_dl_cache(CONFIG)
_ = clear_dl_cache(CONFIG)
# notify
mess_dict = {