Skip to content

Bugfix: 修复SqlSessionService在sqlite下因时区设置不对导致频繁warn#73

Merged
raychen911 merged 1 commit into
trpc-group:mainfrom
weimch:feature/minchang_dev
Jun 2, 2026
Merged

Bugfix: 修复SqlSessionService在sqlite下因时区设置不对导致频繁warn#73
raychen911 merged 1 commit into
trpc-group:mainfrom
weimch:feature/minchang_dev

Conversation

@weimch
Copy link
Copy Markdown
Contributor

@weimch weimch commented Jun 1, 2026

  • 问题:当前在SqlSessionService的实现中,默认创建DB的表中,update_time使用了sqlalchemy的func.now,但在更新时间时,使用了datetime.now,在sqlite实现里,func.now默认使用了utc的时间,而datetime.now不是utc的时间,导致append_event时,因时区不同,导致diff失败,warn告警
  • 解决方案:总是使用func.now来更新时间

- 问题:当前在SqlSessionService的实现中,默认创建DB的表中,update_time使用了sqlalchemy的func.now,但在更新时间时,使用了datetime.now,在sqlite实现里,func.now默认使用了utc的时间,而datetime.now不是utc的时间,导致append_event时,因时区不同,导致diff失败,warn告警
- 解决方案:总是使用func.now来更新时间
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 1, 2026

Codecov Report

❌ Patch coverage is 90.00000% with 3 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@e296c88). Learn more about missing BASE report.

Files with missing lines Patch % Lines
trpc_agent_sdk/sessions/_sql_session_service.py 90.00000% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main         #73   +/-   ##
==========================================
  Coverage        ?   87.32279%           
==========================================
  Files           ?         413           
  Lines           ?       40135           
  Branches        ?           0           
==========================================
  Hits            ?       35047           
  Misses          ?        5088           
  Partials        ?           0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@raychen911 raychen911 merged commit 196fa9f into trpc-group:main Jun 2, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants