fix(auto_system): 修复停止调度器时未判断调度器状态的问题

- 增加判断调度器是否处于运行状态后再调用 shutdown
- 防止未运行调度器调用 shutdown 导致异常
- 优化异常捕获时的日志信息
- 提高停止调度器函数的健壮性
This commit is contained in:
毛鹏
2025-12-05 21:06:28 +08:00
parent d9e04f58ef
commit afe98ebb0e

View File

@@ -209,7 +209,7 @@ class AutoSystemConfig(AppConfig):
def stop_scheduler(self):
"""停止调度器"""
try:
if hasattr(self, 'scheduler') and self.scheduler:
if hasattr(self, 'scheduler') and self.scheduler and self.scheduler.running:
self.scheduler.shutdown()
except Exception as e:
log.system.error(f'停止调度器异常: {e}')