From a29cf83abaeac542f0f2b938747011004ad57bff Mon Sep 17 00:00:00 2001 From: jxxghp Date: Sat, 14 Sep 2024 08:21:13 +0800 Subject: [PATCH] fix bug --- app/chain/search.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/chain/search.py b/app/chain/search.py index 00c8c17f..a3ee205d 100644 --- a/app/chain/search.py +++ b/app/chain/search.py @@ -1,4 +1,5 @@ import pickle +import traceback from concurrent.futures import ThreadPoolExecutor, as_completed from datetime import datetime from typing import Dict @@ -88,10 +89,14 @@ class SearchChain(ChainBase): 获取上次搜索结果 """ # 读取本地文件缓存 - results = self.load_cache(self.__result_temp_file) - if not results: + content = self.load_cache(self.__result_temp_file) + if not content: + return [] + try: + return pickle.loads(content) + except Exception as e: + logger.error(f'加载搜索结果失败:{str(e)} - {traceback.format_exc()}') return [] - return results def process(self, mediainfo: MediaInfo, keyword: str = None,