chore: Improves session update time validation message (#446)

Enhances the error message when a session's last update time is later than the storage update time.
This provides better readability by formatting the timestamps in the error message.

Co-authored-by: Hangfei Lin <hangfei@google.com>
This commit is contained in:
Bart 2025-05-03 23:55:47 +09:00 committed by GitHub
parent c74879d849
commit 24024f7fc4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -484,9 +484,11 @@ class DatabaseSessionService(BaseSessionService):
if storage_session.update_time.timestamp() > session.last_update_time: if storage_session.update_time.timestamp() > session.last_update_time:
raise ValueError( raise ValueError(
f"Session last_update_time {session.last_update_time} is later than" f"Session last_update_time "
f" the upate_time in storage {storage_session.update_time}" f"{datetime.fromtimestamp(session.last_update_time):%Y-%m-%d %H:%M:%S} "
) f"is later than the update_time in storage "
f"{storage_session.update_time:%Y-%m-%d %H:%M:%S}"
)
# Fetch states from storage # Fetch states from storage
storage_app_state = sessionFactory.get( storage_app_state = sessionFactory.get(