Skip to content

Commit f5c2b7d

Browse files
committed
fix: 审查修复 - 失败时允许总览刷新 + sync error 清结果 + 回填保护
1 parent ac601ad commit f5c2b7d

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

quantclass_sync_internal/gui/assets/app.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ document.addEventListener('alpine:init', () => {
129129
// 切换到总览时自动刷新数据(同步进行中不刷新,避免干扰)
130130
switchTab(name) {
131131
this.tab = name;
132-
if (name === 'overview' && this.syncStatus !== 'syncing' && !this.checkUpdateResult) {
132+
if (name === 'overview' && this.syncStatus !== 'syncing'
133+
&& !(this.checkUpdateResult && !this.checkUpdateResult.isError)) {
133134
this.loadOverview();
134135
}
135136
if (name === 'history' && !this.historyLoaded && !this.historyLoading) {
@@ -190,6 +191,7 @@ document.addEventListener('alpine:init', () => {
190191
this.errorMessage = p.error_message || '同步失败';
191192
this.runSummary = p.run_summary; // 部分失败时也携带摘要
192193
this.historyLoaded = false; // 有新运行,下次切历史页时刷新
194+
this.checkUpdateResult = null; // 同步后清除检查更新结果
193195
this.pollTimer = null;
194196
return; // 终态,不再调度下次轮询
195197
}

quantclass_sync_internal/status_store.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,12 +489,15 @@ def update_api_latest_dates(log_dir: Path, api_latest_dates: Dict[str, str]) ->
489489

490490
with open(lock_path, "w") as lock_fd:
491491
_flock_exclusive(lock_fd)
492+
# 文件缺失或损坏时先从历史报告回填,避免覆盖丢失已有状态
492493
existing: Dict[str, Dict[str, str]] = {}
493494
if status_path.exists():
494495
try:
495496
existing = json.loads(status_path.read_text(encoding="utf-8"))
496497
except (OSError, json.JSONDecodeError):
497-
pass
498+
existing = _scan_reports_for_backfill(log_dir)
499+
else:
500+
existing = _scan_reports_for_backfill(log_dir)
498501
for product, date_str in api_latest_dates.items():
499502
if product in existing:
500503
existing[product]["date_time"] = date_str

0 commit comments

Comments
 (0)