feat(weibo): 增加协作 CK 失效筛选与实时同步开关
This commit is contained in:
@@ -190,9 +190,7 @@ def refresh_weibo_account(
|
||||
snapshot = client.fetch_home(activity)
|
||||
client.check_payment_access(activity, home=snapshot)
|
||||
except (WeiboError, ValueError) as exc:
|
||||
account.ck_check_status = _error_status(exc)
|
||||
account.ck_check_message = str(exc)
|
||||
account.ck_checked_at = _now()
|
||||
mark_weibo_account_refresh_failure(db, account, exc, commit=False)
|
||||
if commit:
|
||||
db.commit()
|
||||
raise
|
||||
@@ -204,6 +202,26 @@ def refresh_weibo_account(
|
||||
return snapshot
|
||||
|
||||
|
||||
def mark_weibo_account_refresh_failure(
|
||||
db: Session,
|
||||
account: WeiboAccount,
|
||||
exc: Exception,
|
||||
*,
|
||||
commit: bool = True,
|
||||
) -> bool:
|
||||
"""把一次刷新失败写回账号;业务校验失败不应被误标成 CK 失效。"""
|
||||
|
||||
if not isinstance(exc, (WeiboError, ValueError)):
|
||||
return False
|
||||
account.ck_check_status = _error_status(exc)
|
||||
account.ck_check_message = str(exc)
|
||||
account.ck_checked_at = _now()
|
||||
if commit:
|
||||
db.commit()
|
||||
db.refresh(account)
|
||||
return True
|
||||
|
||||
|
||||
def update_weibo_account_metadata(
|
||||
db: Session,
|
||||
account: WeiboAccount,
|
||||
|
||||
Reference in New Issue
Block a user