chore(plugin): set hot-reload watcher interval to 60s

This commit is contained in:
liuwei
2026-04-16 13:57:37 +08:00
parent f0414e0dff
commit cb0d11e657
2 changed files with 8 additions and 3 deletions

View File

@@ -61,7 +61,8 @@ class PluginManager:
# 热加载相关
self._watcher_thread: Optional[threading.Thread] = None
self._watcher_stop_event = threading.Event()
self._watcher_interval = 2.0
# 默认每 60 秒扫描一次插件目录,降低线上资源消耗
self._watcher_interval = 60.0
self._module_file_state: Dict[str, Dict[str, float]] = {}
self._watcher_lock = threading.RLock()
@@ -132,9 +133,12 @@ class PluginManager:
except Exception as e:
self.LOG.error(f"自动注入 bot 到插件 {plugin.name} 失败: {e}")
def start_hot_reload_watcher(self, interval_seconds: float = 2.0):
def start_hot_reload_watcher(self, interval_seconds: float = 60.0):
"""
启动插件目录变更监听线程(轮询)
Args:
interval_seconds: 轮询间隔秒数,默认 60 秒
"""
with self._watcher_lock:
if self._watcher_thread and self._watcher_thread.is_alive():