Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jxxghp committed Sep 14, 2024
1 parent ede37b8 commit a29cf83
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions app/chain/search.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pickle
import traceback
from concurrent.futures import ThreadPoolExecutor, as_completed
from datetime import datetime
from typing import Dict
Expand Down Expand Up @@ -88,10 +89,14 @@ def last_search_results(self) -> List[Context]:
获取上次搜索结果
"""
# 读取本地文件缓存
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,
Expand Down

0 comments on commit a29cf83

Please sign in to comment.