Commit 0e57908
fix(sessions): correct timezone handling for PostgreSQL in DatabaseSessionService
`create_session` already stored UTC naive datetimes for both SQLite and
PostgreSQL, but the corresponding read path (`get_update_timestamp`) and
write path in `append_event` only handled SQLite, causing incorrect POSIX
timestamps and potential false stale-session errors on non-UTC hosts.
- `get_update_timestamp` / `update_timestamp_tz`: treat PostgreSQL the
same as SQLite — attach UTC tzinfo before calling `.timestamp()`.
- `to_session`: thread the new `is_postgresql` flag through to
`get_update_timestamp`.
- `append_event`: use UTC naive datetime for PostgreSQL `update_time`
(consistent with `create_session`); use UTC-aware datetime for all
other non-SQLite dialects instead of local-time naive.
- `get_session` / `list_sessions`: propagate `is_postgresql` to
`to_session`.1 parent b8e8f6b commit 0e57908
File tree
3 files changed
+58
-30
lines changed- src/google/adk/sessions
- schemas
3 files changed
+58
-30
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
480 | 480 | | |
481 | 481 | | |
482 | 482 | | |
483 | | - | |
| 483 | + | |
484 | 484 | | |
485 | 485 | | |
486 | 486 | | |
| |||
498 | 498 | | |
499 | 499 | | |
500 | 500 | | |
| 501 | + | |
| 502 | + | |
501 | 503 | | |
502 | 504 | | |
503 | 505 | | |
| |||
543 | 545 | | |
544 | 546 | | |
545 | 547 | | |
546 | | - | |
547 | 548 | | |
548 | | - | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
549 | 553 | | |
550 | 554 | | |
551 | 555 | | |
| |||
592 | 596 | | |
593 | 597 | | |
594 | 598 | | |
| 599 | + | |
595 | 600 | | |
596 | 601 | | |
597 | 602 | | |
598 | 603 | | |
599 | 604 | | |
600 | | - | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
601 | 610 | | |
602 | 611 | | |
603 | 612 | | |
| |||
633 | 642 | | |
634 | 643 | | |
635 | 644 | | |
| 645 | + | |
636 | 646 | | |
637 | 647 | | |
638 | 648 | | |
| |||
662 | 672 | | |
663 | 673 | | |
664 | 674 | | |
665 | | - | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
666 | 678 | | |
667 | 679 | | |
668 | 680 | | |
| |||
728 | 740 | | |
729 | 741 | | |
730 | 742 | | |
731 | | - | |
| 743 | + | |
732 | 744 | | |
733 | 745 | | |
734 | 746 | | |
735 | 747 | | |
736 | | - | |
| 748 | + | |
737 | 749 | | |
738 | 750 | | |
739 | 751 | | |
740 | 752 | | |
741 | 753 | | |
742 | 754 | | |
743 | 755 | | |
744 | | - | |
| 756 | + | |
745 | 757 | | |
746 | 758 | | |
747 | 759 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
174 | 179 | | |
175 | | - | |
176 | 180 | | |
177 | | - | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
178 | 184 | | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
183 | 188 | | |
184 | 189 | | |
185 | 190 | | |
| |||
195 | 200 | | |
196 | 201 | | |
197 | 202 | | |
| 203 | + | |
198 | 204 | | |
199 | 205 | | |
200 | 206 | | |
| |||
208 | 214 | | |
209 | 215 | | |
210 | 216 | | |
211 | | - | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
212 | 220 | | |
213 | 221 | | |
214 | 222 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
121 | 126 | | |
122 | | - | |
123 | 127 | | |
124 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
125 | 131 | | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
130 | 135 | | |
131 | 136 | | |
132 | 137 | | |
| |||
142 | 147 | | |
143 | 148 | | |
144 | 149 | | |
| 150 | + | |
145 | 151 | | |
146 | 152 | | |
147 | 153 | | |
| |||
155 | 161 | | |
156 | 162 | | |
157 | 163 | | |
158 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
159 | 167 | | |
160 | 168 | | |
161 | 169 | | |
| |||
0 commit comments