fix(modules): serialize configuration reload lifecycle (#6122)

This commit is contained in:
InfinityPacer
2026-07-15 17:28:49 +08:00
committed by GitHub
parent 00d46f3aab
commit 893269f8c1
16 changed files with 288 additions and 83 deletions
+7 -9
View File
@@ -43,12 +43,6 @@ class TheMovieDbModule(_ModuleBase):
self.category = CategoryHelper()
self.scraper = TmdbScraper()
def on_config_changed(self):
# 停止模块
self.stop()
# 初始化模块
self.init_module()
@staticmethod
def get_name() -> str:
return "TheMovieDb"
@@ -74,9 +68,13 @@ class TheMovieDbModule(_ModuleBase):
"""
return 1
def stop(self):
self.cache.save()
self.tmdb.close()
def stop(self) -> None:
"""停止模块"""
# 缓存持久化失败不能阻断 HTTP 客户端关闭
try:
self.cache.save()
finally:
self.tmdb.close()
def test(self) -> Tuple[bool, str]:
"""