This commit is contained in:
jxxghp 2023-08-02 10:10:40 +08:00
parent 99ed6fd163
commit a87942c8f6
2 changed files with 8 additions and 0 deletions

View File

@ -1,3 +1,4 @@
import gc
from typing import Any from typing import Any
from app.chain.download import * from app.chain.download import *
@ -315,6 +316,9 @@ class MessageChain(ChainBase):
userid=userid, total=len(medias)) userid=userid, total=len(medias))
# 保存缓存 # 保存缓存
self.save_cache(user_cache, self._cache_file) self.save_cache(user_cache, self._cache_file)
# 主动资源回收
del user_cache
gc.collect()
def __post_medias_message(self, channel: MessageChannel, def __post_medias_message(self, channel: MessageChannel,
title: str, items: list, userid: str, total: int): title: str, items: list, userid: str, total: int):

View File

@ -1,5 +1,6 @@
import json import json
import re import re
import gc
from datetime import datetime from datetime import datetime
from typing import Dict, List, Optional, Union, Tuple from typing import Dict, List, Optional, Union, Tuple
@ -415,6 +416,9 @@ class SubscribeChain(ChainBase):
self.__match(torrents_cache) self.__match(torrents_cache)
# 保存缓存到本地 # 保存缓存到本地
self.save_cache(torrents_cache, self._cache_file) self.save_cache(torrents_cache, self._cache_file)
# 主动资源回收
del torrents_cache
gc.collect()
def __match(self, torrents_cache: Dict[str, List[Context]]): def __match(self, torrents_cache: Dict[str, List[Context]]):
""" """