Commit 1fddf90
committed
fix(sessions): use async iteration for VertexAiSessionService.list_sessions pagination
The sessions_iterator returned by api_client.agent_engines.sessions.list()
is an AsyncPager that only fetches additional pages when consumed via
async iteration (__aiter__/__anext__). Using a synchronous `for` loop
only retrieved the first page (~100 sessions), silently dropping all
subsequent pages.
Changed `for` to `async for` to enable proper async pagination,
allowing all sessions to be returned regardless of count.
Fixes #43021 parent ec660ed commit 1fddf90
2 files changed
Lines changed: 18 additions & 7 deletions
File tree
- src/google/adk/sessions
- tests/unittests/sessions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
218 | | - | |
| 218 | + | |
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
| |||
Lines changed: 17 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
264 | 264 | | |
265 | 265 | | |
266 | 266 | | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
267 | 278 | | |
268 | 279 | | |
269 | 280 | | |
| |||
300 | 311 | | |
301 | 312 | | |
302 | 313 | | |
303 | | - | |
| 314 | + | |
304 | 315 | | |
305 | 316 | | |
306 | | - | |
307 | | - | |
| 317 | + | |
| 318 | + | |
308 | 319 | | |
309 | 320 | | |
310 | 321 | | |
311 | | - | |
| 322 | + | |
312 | 323 | | |
313 | 324 | | |
314 | | - | |
| 325 | + | |
315 | 326 | | |
316 | | - | |
| 327 | + | |
317 | 328 | | |
318 | 329 | | |
319 | 330 | | |
| |||
0 commit comments