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 <noreply@anthropic.com>
This commit is contained in:
8
watch.py
8
watch.py
@@ -22,6 +22,14 @@ def run_once(cfg):
|
|||||||
logger.info("开始同步 LAN 文件...")
|
logger.info("开始同步 LAN 文件...")
|
||||||
sync_results = sync_all_files(cfg, excel_dir)
|
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
|
# 2. Determine which tables need migration
|
||||||
tables_to_migrate = determine_tables_to_migrate(cfg, sync_results)
|
tables_to_migrate = determine_tables_to_migrate(cfg, sync_results)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user