fix(audit): created_at 微秒精度,保证 append-only 轨迹可精确排序
This commit is contained in:
parent
7673a7acdf
commit
a3a15ae666
@ -10,6 +10,7 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
from datetime import datetime
|
||||||
from sqlor.dbpools import DBPools
|
from sqlor.dbpools import DBPools
|
||||||
from appPublic.uniqueID import getID
|
from appPublic.uniqueID import getID
|
||||||
|
|
||||||
@ -54,6 +55,8 @@ async def record_audit(tenant_id, entity, entity_id, action,
|
|||||||
'who': who,
|
'who': who,
|
||||||
'agent_id': agent_id,
|
'agent_id': agent_id,
|
||||||
'detail': detail,
|
'detail': detail,
|
||||||
|
# 微秒精度,保证 append-only 轨迹可精确排序(秒级同秒内会乱序)
|
||||||
|
'created_at': datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f'),
|
||||||
}
|
}
|
||||||
if sor is not None:
|
if sor is not None:
|
||||||
await sor.C('audit_log', data)
|
await sor.C('audit_log', data)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user