Add 429 retry/backoff to Grain API client - #6
Draft
dplakon wants to merge 1 commit into
Draft
Conversation
The Grain API rate-limits aggressively and returns HTTP 429 during rapid pagination in list_all_recordings, which caused the daily meeting fetch to fail immediately with no retry. Wrap _get in a retry loop with exponential backoff that honors the Retry-After header when present, so paginated fetches can complete. Co-Authored-By: Oz <oz-agent@warp.dev>
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
The Grain API rate-limits aggressively and returns HTTP 429 during rapid pagination in
list_all_recordings. This causedscripts/fetch_daily_meetings.pyto fail immediately on the second page of results with no retry, blocking the daily meeting pipeline.Change
_getinscripts/grain_client.pyin a retry loop with exponential backoff.Retry-Afterresponse header when present; otherwise back off2 * 2^attemptseconds, up to 5 attempts.Testing
python scripts/fetch_daily_meetings.py todayafter the change; the fetch backed off through the 429s and completed successfully, returning 4 external customer meetings for 2026-07-24.Conversation: https://app.warp.dev/conversation/c125a783-4dbd-4922-b047-f7158d05d372
Run: https://oz.warp.dev/runs/019f97a5-06c0-7653-a9f3-0f83e0148ac0
This PR was generated with Oz.