Skip to content

Add 429 retry/backoff to Grain client - #2

Draft
dplakon wants to merge 1 commit into
mainfrom
fix/grain-api-429-retry
Draft

Add 429 retry/backoff to Grain client#2
dplakon wants to merge 1 commit into
mainfrom
fix/grain-api-429-retry

Conversation

@dplakon

@dplakon dplakon commented Jul 17, 2026

Copy link
Copy Markdown

Summary

The Grainiac daily meeting fetch (scripts/fetch_daily_meetings.py) was failing with HTTP Error 429: Too Many Requests from the Grain API. The failure consistently occurred on the second (cursor-based) page of results because list_all_recordings paginated back-to-back with no delay and the client had no retry handling for rate limits.

Changes

  • Add exponential backoff with Retry-After header support on 429 responses in grain_client._get() (up to 5 attempts).
  • Add a small 0.5s delay between pagination requests in list_all_recordings to avoid tripping the rate limit in the first place.

Testing

  • Ran python scripts/fetch_daily_meetings.py today — previously failed on page 2 with 429; now paginates through all recordings and returns the expected JSON meeting list.

Conversation: https://app.warp.dev/conversation/2cbe8b08-da81-4b5a-a805-77589012a120
Run: https://oz.warp.dev/runs/019f71a3-a26d-7604-b3c4-1d020091a747

This PR was generated with Oz.

The daily meeting fetch was failing with HTTP 429 (Too Many Requests)
because list_all_recordings paginated back-to-back with no delay or
retry handling. Add exponential backoff with Retry-After support on
429 responses in _get(), plus a small delay between pagination
requests to avoid tripping the rate limit.

Co-Authored-By: Oz <oz-agent@warp.dev>
@dplakon
dplakon requested a review from Jerrydiii July 17, 2026 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants