From 8e4d5824c93c509ee27b85ad33b53f3a29417b6e Mon Sep 17 00:00:00 2001 From: Misaka_Company Date: Mon, 1 Jun 2026 16:33:54 +0800 Subject: [PATCH] fix: add summary warning when all LAN sources are unreachable When the network is down, sync_file() logs individual errors for each file. Now run_once() detects when all files fail and emits a single summary warning instead of proceeding with redundant "no changes" logs. Co-Authored-By: Claude Opus 4.6 --- watch.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/watch.py b/watch.py index bd6282b..0fd2e5a 100644 --- a/watch.py +++ b/watch.py @@ -22,6 +22,14 @@ def run_once(cfg): logger.info("开始同步 LAN 文件...") sync_results = sync_all_files(cfg, excel_dir) + # 如果全部同步失败,大概率是网络中断 + all_failed = sync_results and all(s == 'error' for s, _ in sync_results.values()) + if all_failed: + logger.warning( + f"所有 LAN 源文件不可达 ({len(sync_results)} 个),可能网络中断,跳过本轮同步" + ) + return + # 2. Determine which tables need migration tables_to_migrate = determine_tables_to_migrate(cfg, sync_results)