Skip to content

Commit b0aed71

Browse files
authored
feat(fai): make content hash updated at timezone-naive (#5813)
1 parent 05e10cf commit b0aed71

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

servers/fai/src/fai/models/db/content_hash_db.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from datetime import UTC, datetime
1+
from datetime import datetime
22

33
from sqlalchemy import Column, DateTime, Index, String
44

@@ -19,8 +19,8 @@ class ContentHashDb(Base):
1919
content_hash = Column(String, nullable=False, comment="SHA-256 hash of page markdown or endpoint document content")
2020

2121
# Metadata
22-
indexed_at = Column(DateTime, nullable=False, default=lambda: datetime.now(UTC))
23-
updated_at = Column(DateTime, nullable=False, default=lambda: datetime.now(UTC), onupdate=lambda: datetime.now(UTC))
22+
indexed_at = Column(DateTime, nullable=False, default=datetime.utcnow)
23+
updated_at = Column(DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
2424

2525
__table_args__ = (
2626
Index("idx_content_hashes_domain", "domain"),

servers/fai/src/fai/routes/content_hash.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
The actual diffing logic lives in the fai-reindexing service.
66
"""
77

8-
from datetime import UTC, datetime
8+
from datetime import datetime
99

1010
from fastapi import Body, Depends
1111
from fastapi.encoders import jsonable_encoder
@@ -99,7 +99,7 @@ async def batch_upsert_content_hashes(
9999

100100
if existing:
101101
existing.content_hash = entry.content_hash
102-
existing.updated_at = datetime.now(UTC)
102+
existing.updated_at = datetime.utcnow()
103103
else:
104104
new_hash = ContentHashDb(domain=domain, parent_id=entry.parent_id, content_hash=entry.content_hash)
105105
db.add(new_hash)

0 commit comments

Comments
 (0)