Skip to content

Add rate limit retry logic to upgrade-ai command#156

Closed
zhangzhenghao wants to merge 1 commit intogorse-io:masterfrom
zhangzhenghao:add-rate-limit-retry
Closed

Add rate limit retry logic to upgrade-ai command#156
zhangzhenghao wants to merge 1 commit intogorse-io:masterfrom
zhangzhenghao:add-rate-limit-retry

Conversation

@zhangzhenghao
Copy link
Copy Markdown
Contributor

Add exponential backoff retry logic for OpenAI API 429 (Too Many Requests) errors in the upgrade-ai command.

Changes:

  • Import RateLimitError from openai
  • Add call_isai_with_retry() function with exponential backoff (default: 5 retries, base delay 1s)
  • Update upgrade_ai() to use retry wrapper
  • Add explicit handling for RateLimitError after retries exhausted

The retry logic:

  • Initial delay: 1 second
  • Each retry doubles the delay (1s → 2s → 4s → 8s → 16s)
  • Max 5 retries before giving up
  • Other exceptions are passed through without retry

@zhenghaoz zhenghaoz closed this Apr 9, 2026
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