fix(plugins): align watcher lifecycle with startup (#6366)

This commit is contained in:
InfinityPacer
2026-08-20 15:24:15 +08:00
committed by GitHub
parent 4e3a6c8032
commit 2e5cc6c669
4 changed files with 160 additions and 26 deletions
+5 -10
View File
@@ -275,10 +275,6 @@ class PluginManager(ConfigReloadMixin, metaclass=Singleton):
"plugins",
self.resolve_event_handler_instance,
)
# 开发者模式监测插件修改
if settings.DEV or settings.PLUGIN_AUTO_RELOAD:
self.__start_monitor()
def resolve_event_handler_instance(
self,
owner_class: Type[Any],
@@ -387,6 +383,11 @@ class PluginManager(ConfigReloadMixin, metaclass=Singleton):
"""返回配置重载日志使用的功能名称。"""
return "插件文件修改监测"
def start_monitor(self):
"""按当前配置启动插件文件修改监测。"""
if settings.DEV or settings.PLUGIN_AUTO_RELOAD:
self._plugin_monitor.start()
def reload_monitor(self):
"""
重新加载插件文件修改监测
@@ -395,12 +396,6 @@ class PluginManager(ConfigReloadMixin, metaclass=Singleton):
enabled=settings.DEV or settings.PLUGIN_AUTO_RELOAD
)
def __start_monitor(self):
"""
启用监测插件文件修改监测
"""
self._plugin_monitor.start()
def stop_monitor(self):
"""
停止监测插件文件修改监测