fix(api): _persist_incident 新增顯式 commit + 追蹤日誌
根因: DB 變更未被 commit,導致 Incident 狀態更新不持久化 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -493,6 +493,13 @@ class ProposalService:
|
||||
record.status = incident.status.value
|
||||
record.proposal_ids = [str(pid) for pid in incident.proposal_ids]
|
||||
record.updated_at = incident.updated_at
|
||||
# 顯式 commit 確保變更持久化
|
||||
await db.commit()
|
||||
logger.info(
|
||||
"db_incident_updated",
|
||||
incident_id=incident.incident_id,
|
||||
new_status=incident.status.value,
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
logger.warning(
|
||||
@@ -524,6 +531,12 @@ class ProposalService:
|
||||
Returns:
|
||||
是否更新成功
|
||||
"""
|
||||
logger.info(
|
||||
"resolve_incident_starting",
|
||||
incident_id=incident_id,
|
||||
approval_id=approval_id,
|
||||
)
|
||||
|
||||
try:
|
||||
incident = await self._load_incident(incident_id)
|
||||
if not incident:
|
||||
@@ -534,6 +547,12 @@ class ProposalService:
|
||||
)
|
||||
return False
|
||||
|
||||
logger.info(
|
||||
"resolve_incident_loaded",
|
||||
incident_id=incident_id,
|
||||
current_status=incident.status.value,
|
||||
)
|
||||
|
||||
# 更新狀態
|
||||
old_status = incident.status
|
||||
incident.status = IncidentStatus.RESOLVED
|
||||
|
||||
Reference in New Issue
Block a user