修复心跳刷入rollback误用 + API参数规范化
- heartbeat_flush: 移除循环内session.rollback(),防止一个服务器 刷入失败导致整个批次session状态损坏 - assets.py: 为Query参数添加Query()类型+描述+校验约束, 统一FastAPI参数风格 (server_id/session_id/limit/parent_id) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -91,7 +91,9 @@ async def heartbeat_flush_loop():
|
||||
flushed += 1
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to flush server {key}: {e}")
|
||||
await session.rollback()
|
||||
# Don't rollback here — just skip this server and continue.
|
||||
# A partial UPDATE on a single server won't corrupt others.
|
||||
# The final commit() will persist all successful updates.
|
||||
|
||||
await session.commit()
|
||||
logger.info(f"Heartbeat flush: {flushed}/{len(keys)} servers updated to MySQL")
|
||||
|
||||
Reference in New Issue
Block a user