feat: sync account priorities after rate changes

This commit is contained in:
liumangmang
2026-05-29 17:51:12 +08:00
parent c5778bb3e7
commit 5c20ddc8e6
21 changed files with 1510 additions and 26 deletions
+5 -4
View File
@@ -512,13 +512,14 @@ def check_now(uid: int, db: Session = Depends(get_db), _=Depends(get_current_use
if was_unhealthy:
webhook_service.send_status_event(db, u.id, u.name, u.base_url, "upstream_recovered")
# 先同步 Key 状态(标记 orphaned),再执行优先级同步(避免未标记的 key 参与计算)
from app.services.scheduler import _sync_upstream_keys as _synck
_synck(uid, snapshot, new_row.captured_at)
if changes:
webhook_service.send_rate_changed(db, u.id, u.name, u.base_url, changes)
website_sync.sync_affected_bindings(db, u.id, changes)
# 同步 SmartUp Key 状态(使用实际快照入库时间,与定时任务一致)
from app.services.scheduler import _sync_upstream_keys as _synck
_synck(uid, snapshot, new_row.captured_at)
website_sync.sync_account_priorities_for_upstream(db, u.id)
msg = f"检测成功,{len(groups)} 个分组"
if changes: