fix(aws): retry throttled paginated calls at the client layer#52
Merged
Conversation
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.
Summary
paginate()incore/utils_aws.pyretried a throttled page fetch by callingnext()again on the samePageIterator. Since aPageIteratoris a Python generator, once its body raises the frame is finished — every subsequentnext()yieldsStopIteration, so the retry appeared to succeed andpaginate()returned a truncated prefix as if it were the full result. Silent undercounts on exactly the accounts that get throttled most: large ones.AWS_RETRY_CONFIG = Config(retries={"mode": "adaptive", "max_attempts": 8}), applied on everysession.client(...)inutils_aws.pyandutils_egress_aws.py. Throttling is now retried at the HTTP layer inside the paginator's generator, where resuming is safe;paginate()becomes a plainfor page in paginator.paginate(...)loop with no swallowing._retry_call,aws_api_call_with_retry) and their tests — keeping them alongside the client-level config invites the next contributor to reach for the wrong-layer pattern again.paginate()/paginate_or_call(), including one that pins the no-swallowing contract by driving a paginator that raisesClientError(Throttling)mid-iteration and asserts the exception propagates instead of being silently truncated.