From 78dd2e4e68e96250970240597c82488acc62f282 Mon Sep 17 00:00:00 2001 From: SXP-Simon Date: Wed, 1 Oct 2025 23:53:43 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20(=E8=87=AA=E5=8A=A8=E5=88=86=E6=9E=90?= =?UTF-8?q?=E5=A4=84=E7=90=86)=20=E7=BA=A0=E6=AD=A3=E5=88=86=E6=9E=90?= =?UTF-8?q?=E6=97=A5=E6=9C=9F=E5=A4=84=E7=90=86=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #18 --- src/scheduler/auto_scheduler.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/scheduler/auto_scheduler.py b/src/scheduler/auto_scheduler.py index 95d6fed..54753fd 100644 --- a/src/scheduler/auto_scheduler.py +++ b/src/scheduler/auto_scheduler.py @@ -92,18 +92,17 @@ class AutoScheduler: # 执行自动分析 if self.config_manager.get_enable_auto_analysis(): - # 检查是否今天已经执行过 - today = now.date() - if self.last_execution_date == today: - logger.info(f"今天 {today} 已经执行过自动分析,跳过执行") + # 检查今天是否已经执行过,防止重复执行 + if self.last_execution_date == target_time.date(): + logger.info(f"今天 {target_time.date()} 已经执行过自动分析,跳过执行") # 等待到明天再检查 await asyncio.sleep(3600) # 等待1小时后再检查 continue logger.info("开始执行定时分析") await self._run_auto_analysis() - self.last_execution_date = today # 记录执行日期 - logger.info(f"定时分析执行完成,记录执行日期: {today}") + self.last_execution_date = target_time.date() # 记录执行日期 + logger.info(f"定时分析执行完成,记录执行日期: {self.last_execution_date}") else: logger.info("自动分析已禁用,跳过执行") break