Skip to content

Add 429 retry/backoff to Grain API client - #6

Draft
dplakon wants to merge 1 commit into
mainfrom
fix/grain-client-429-backoff
Draft

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

Conversation

@dplakon

@dplakon dplakon commented Jul 25, 2026

Copy link
Copy Markdown

Summary

The Grain API rate-limits aggressively and returns HTTP 429 during rapid pagination in list_all_recordings. This caused scripts/fetch_daily_meetings.py to fail immediately on the second page of results with no retry, blocking the daily meeting pipeline.

Change

  • Wrap _get in scripts/grain_client.py in a retry loop with exponential backoff.
  • Honor the Retry-After response header when present; otherwise back off 2 * 2^attempt seconds, up to 5 attempts.
  • Log backoff attempts to stderr so pipeline runs remain observable.

Testing

  • Re-ran python scripts/fetch_daily_meetings.py today after 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.

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>
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.

1 participant