From d5331b728d2e7259bf560bae07bf762db09cb5d3 Mon Sep 17 00:00:00 2001 From: DLmaster361 Date: Sun, 21 Sep 2025 18:09:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=90=8E=E7=AB=AFws=E4=B8=8D=E5=86=8Dra?= =?UTF-8?q?ise=E6=97=A0=E8=BF=9E=E6=8E=A5=E9=94=99=E8=AF=AF=EF=BC=9B?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=9A=E6=97=B6=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/core/config.py | 2 +- app/core/timer.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/core/config.py b/app/core/config.py index c580290..4c48848 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -966,7 +966,7 @@ class AppConfig(GlobalConfig): async def send_json(self, data: dict) -> None: """通过WebSocket发送JSON数据""" if Config.websocket is None: - raise RuntimeError("WebSocket 未连接") + logger.warning("WebSocket 未连接") else: await Config.websocket.send_json(data) diff --git a/app/core/timer.py b/app/core/timer.py index 0f1d338..2af2b2f 100644 --- a/app/core/timer.py +++ b/app/core/timer.py @@ -72,6 +72,7 @@ class _MainTimer: await asyncio.sleep(3600) + @logger.catch() async def timed_start(self): """定时启动代理任务""" @@ -85,10 +86,14 @@ class _MainTimer: continue # 避免重复调起任务 - if curtime == Config.get("Data", "LastTimeStarted"): + if curtime == queue.get("Data", "LastTimedStart"): + logger.debug("已启动过任务,跳过本任务") continue for time_set in queue.TimeSet.values(): + logger.debug( + f"检查定时任务:{time_set.get('Info', 'Time')}, 启用状态:{time_set.get('Info', 'Enabled')}" + ) if ( time_set.get("Info", "Enabled") and curtime[11:16] == time_set.get("Info", "Time") @@ -108,6 +113,8 @@ class _MainTimer: async def set_silence(self): """静默模式通过模拟老板键来隐藏模拟器窗口""" + logger.debug("检查静默模式") + if ( len(Config.if_ignore_silence) > 0 and Config.get("Function", "IfSilence") @@ -140,5 +147,7 @@ class _MainTimer: except Exception as e: logger.exception(f"模拟按键时出错: {e}") + logger.debug("静默模式检查完毕") + MainTimer = _MainTimer()