Skip to content

fix(aws): retry throttled paginated calls at the client layer#52

Merged
bencehezso merged 1 commit into
mainfrom
task/fix_aws_pagination_throttle_bug
Jul 23, 2026
Merged

fix(aws): retry throttled paginated calls at the client layer#52
bencehezso merged 1 commit into
mainfrom
task/fix_aws_pagination_throttle_bug

Conversation

@bencehezso

Copy link
Copy Markdown
Contributor

Summary

  • paginate() in core/utils_aws.py retried a throttled page fetch by calling next() again on the same PageIterator. Since a PageIterator is a Python generator, once its body raises the frame is finished — every subsequent next() yields StopIteration, so the retry appeared to succeed and paginate() returned a truncated prefix as if it were the full result. Silent undercounts on exactly the accounts that get throttled most: large ones.
  • Pushed retries down to botocore via AWS_RETRY_CONFIG = Config(retries={"mode": "adaptive", "max_attempts": 8}), applied on every session.client(...) in utils_aws.py and utils_egress_aws.py. Throttling is now retried at the HTTP layer inside the paginator's generator, where resuming is safe; paginate() becomes a plain for page in paginator.paginate(...) loop with no swallowing.
  • Deleted the now-unused hand-rolled retry helpers (_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.
  • Added regression tests for paginate() / paginate_or_call(), including one that pins the no-swallowing contract by driving a paginator that raises ClientError(Throttling) mid-iteration and asserts the exception propagates instead of being silently truncated.

@bencehezso bencehezso self-assigned this Jul 23, 2026
@bencehezso bencehezso added the bug Something isn't working label Jul 23, 2026
@bencehezso
bencehezso merged commit d48f3a7 into main Jul 23, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant