Handle an error with a paging endpoint#364
Merged
michael-richey merged 24 commits intomainfrom Aug 13, 2025
Merged
Conversation
heyronhay
approved these changes
Aug 13, 2025
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.
What does this PR do?
If a paginated request fails try with smaller page sizes. In some cases this will solve the problem, in other cases there may be 1 resource that causes the endpoint to throw a 500 even by itself. Get as many resources as we can from the page skipping over and warning about the bad resource.
Description of the Change
Page number and page size make this very difficult to deal with. The fact that different endpoints use different methods for pagination make it worse. This approach halves the batch size until things start functioning. If batch size gets all the way down to 1 and the request still fails then skip over it. The tricky part is then to keep pulling at the smaller batch sizes until we can scale back up to the original batch size.
This change surfaced an error with team membership pagination. The PaginationConfiguration instance changes as we page through it so we can't use the same instance for each paginated request.
There's an async bug where
remainingisn't always recalculated causing the loop to hang:remainingwas always artificially set to 1 to get into the loop the first time. Now we immediately switchremainingto 0 until we can recalculate it. Probably need to spend some time refactoring this whole loop.The actual github secret scanner doesn't want us to commit the cassette for the SDS because it has fake secrets in it as examples.