Skip to content

feat: retry on rate_limit_exceeded errors#46

Merged
felipefreitag merged 10 commits intoresend:mainfrom
devinscodebase:feat/retry-on-rate-limit
Mar 13, 2026
Merged

feat: retry on rate_limit_exceeded errors#46
felipefreitag merged 10 commits intoresend:mainfrom
devinscodebase:feat/retry-on-rate-limit

Conversation

@devinscodebase
Copy link
Contributor

@devinscodebase devinscodebase commented Mar 12, 2026

When the Resend API returns a 429 with error name rate_limit_exceeded, the CLI now retries up to 3 times before giving up. It reads the retry-after header when available, falling back to exponential backoff (1s, 2s, 4s). The spinner updates to show retry status.

Only rate_limit_exceeded is retried. Quota errors (daily_quota_exceeded, monthly_quota_exceeded) are not retried since they will not resolve by waiting.

Closes #41


Summary by cubic

Add automatic retries for 429 rate_limit_exceeded in CLI ops and show retry status in the spinner.

  • New Features
    • Retries up to 3 times in withSpinner; uses retry-after when present, else 1s/2s/4s; derives MAX_RETRIES from delay list.
    • Skips retries for daily_quota_exceeded and monthly_quota_exceeded.
    • Tests cover retry-after parsing, fallback delays, and non-retryable errors; migrated to vitest; batch email test now uses application_error.

Written for commit bca3154. Summary will update on new commits.

When the Resend API returns a 429 with error name rate_limit_exceeded,
the CLI now retries up to 3 times before giving up. It reads the
retry-after header when available, falling back to exponential backoff
(1s, 2s, 4s). The spinner updates to show retry status.

Only rate_limit_exceeded is retried. Quota errors (daily_quota_exceeded,
monthly_quota_exceeded) are not retried since they will not resolve by
waiting.

Closes resend#41
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files


Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Add one-off context when rerunning by tagging @cubic-dev-ai with guidance or docs links (including llms.txt)
  • Ask questions if you need clarification on any suggestion

@felipefreitag felipefreitag merged commit 51d989b into resend:main Mar 13, 2026
7 checks passed
@devinscodebase devinscodebase deleted the feat/retry-on-rate-limit branch March 13, 2026 18:14
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.

Add retry mechanism when rate limits are hit

2 participants