From bcb1fc16009dd713fbb8cfbee8cf8a9b3d1e106d Mon Sep 17 00:00:00 2001 From: jxxghp Date: Thu, 21 Sep 2023 23:12:06 +0800 Subject: [PATCH] fix memory --- app/chain/torrents.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/chain/torrents.py b/app/chain/torrents.py index c86bdf53..b70c4acc 100644 --- a/app/chain/torrents.py +++ b/app/chain/torrents.py @@ -60,7 +60,7 @@ class TorrentsChain(ChainBase, metaclass=Singleton): else: return self.load_cache(self._rss_file) or {} - @cached(cache=TTLCache(maxsize=128, ttl=600)) + @cached(cache=TTLCache(maxsize=128 if settings.BIG_MEMORY_MODE else 1, ttl=600)) def browse(self, domain: str) -> List[TorrentInfo]: """ 浏览站点首页内容,返回种子清单,TTL缓存10分钟 @@ -73,7 +73,7 @@ class TorrentsChain(ChainBase, metaclass=Singleton): return [] return self.refresh_torrents(site=site) - @cached(cache=TTLCache(maxsize=128, ttl=300)) + @cached(cache=TTLCache(maxsize=128 if settings.BIG_MEMORY_MODE else 1, ttl=300)) def rss(self, domain: str) -> List[TorrentInfo]: """ 获取站点RSS内容,返回种子清单,TTL缓存5分钟