fix(awooop): store outbound sent timestamp as naive utc
This commit is contained in:
@@ -489,7 +489,11 @@ async def record_outbound_message(
|
||||
source_envelope_json = json.dumps(envelope, ensure_ascii=False, default=str)
|
||||
|
||||
actual_status = "shadow" if is_shadow else send_status
|
||||
sent_at = datetime.now(UTC) if actual_status == "sent" else None
|
||||
sent_at = (
|
||||
datetime.now(UTC).replace(tzinfo=None)
|
||||
if actual_status == "sent"
|
||||
else None
|
||||
)
|
||||
|
||||
await ensure_completed_shadow_run(
|
||||
db,
|
||||
|
||||
@@ -135,3 +135,4 @@ async def test_record_outbound_message_sets_sent_at_for_sent_messages() -> None:
|
||||
assert ":sent_at" in insert_statement
|
||||
assert session.param_sets[-1]["send_status"] == "sent"
|
||||
assert session.param_sets[-1]["sent_at"] is not None
|
||||
assert session.param_sets[-1]["sent_at"].tzinfo is None
|
||||
|
||||
@@ -7308,5 +7308,6 @@ OK
|
||||
|
||||
- rollback transaction smoke 抓到 asyncpg bind parameter 型別推論問題:`CASE WHEN :send_status = 'sent'` 會被推成 text/varchar ambiguous。
|
||||
- 第一版 `CAST(:send_status AS text)` 仍會因同一 bind param 同時插入 varchar 與比較而 ambiguous;最終改成 Python 端計算 `sent_at` 參數,SQL 只插入 `:sent_at`,避免 outbound mirror 在 production 寫入時失敗。
|
||||
- 第二次 rollback smoke 抓到 DB 欄位是 `timestamp without time zone`,已改成 naive UTC `datetime.now(UTC).replace(tzinfo=None)`,避免 asyncpg timezone-aware bind 失敗。
|
||||
|
||||
**目前整體進度**:約 69%。
|
||||
|
||||
Reference in New Issue
Block a user