Repository navigation
fix: resolve next page cursor loop - #189
Merged
Merged
Conversation
Reviewer's GuideThis PR corrects the pagination logic by fetching one extra record, detecting if there’s a next page, slicing the result to the requested page size, and generating or clearing the next_page_token accordingly. Sequence diagram for updated pagination logic in list_taskssequenceDiagram
participant Client
participant TaskRunsService
participant DBClient
Client->>TaskRunsService: list_tasks(page_size)
TaskRunsService->>DBClient: find(filter, projection).sort().limit(page_size+1)
DBClient-->>TaskRunsService: tasks_list (up to page_size+1 items)
alt More than page_size items
TaskRunsService->>TaskRunsService: next_page_token = tasks_list[page_size-1]["_id"]
TaskRunsService->>TaskRunsService: tasks_list = tasks_list[:page_size]
else No more items
TaskRunsService->>TaskRunsService: next_page_token = ""
end
TaskRunsService-->>Client: tasks_list, next_page_token
Class diagram for updated list_tasks pagination methodclassDiagram
class TaskRunsService {
+list_tasks(**kwargs) dict
}
class DBClient {
+find(filter, projection)
}
TaskRunsService --> DBClient: uses
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey @Nidhi091999 - I've reviewed your changes and they look great!
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
uniqueg
approved these changes
Aug 18, 2025
keshxvdayal
pushed a commit
that referenced
this pull request
Feb 7, 2026
This was referenced Oct 22, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix(pagination): resolve next page cursor loop
Summary by Sourcery
Fix list_tasks pagination to prevent infinite cursor loops by adjusting the query limit and next_page_token logic.
Bug Fixes:
Enhancements: