fix(audit): created_at 微秒精度,保证 append-only 轨迹可精确排序

This commit is contained in:
ymq 2026-08-16 23:43:40 +08:00
parent 7673a7acdf
commit a3a15ae666

View File

@ -10,6 +10,7 @@
"""
import logging
from datetime import datetime
from sqlor.dbpools import DBPools
from appPublic.uniqueID import getID
@ -54,6 +55,8 @@ async def record_audit(tenant_id, entity, entity_id, action,
'who': who,
'agent_id': agent_id,
'detail': detail,
# 微秒精度,保证 append-only 轨迹可精确排序(秒级同秒内会乱序)
'created_at': datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f'),
}
if sor is not None:
await sor.C('audit_log', data)