-
Notifications
You must be signed in to change notification settings - Fork 1.6k
chore: add retries for all requests #5354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
10 Skipped Deployments
|
Visual Regression Test Results ✅ Passed✨ No visual changes detected Chromatic Build: https://www.chromatic.com/build?appId=6493191bf4b10fed8ca7353f&number=436 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds retry logic to three API methods (fetchProjectConfig, fetchAllowedOrigins, and fetchUsage) to improve reliability when communicating with backend services.
- Introduces a new
withRetrieshelper function to handle retry logic - Configures all three methods with 3 retries and 5-second intervals between attempts
- Imports
ConstantsUtilfrom controllers to use theFIVE_SEC_MSconstant
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
📦 Bundle Size Check✅ All bundles are within size limits 📊 View detailed bundle sizes> @reown/[email protected] size /home/runner/work/appkit/appkit > size-limit |
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||
| // 3 retries with 5 seconds interval | ||
| ControllersConstantsUtil.FIVE_SEC_MS, | ||
| 3 | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Retry wrapper incorrectly retries client errors.
The withRetries wrapper retries all errors including HTTP 429 (rate limit) responses. When rate limited, the function makes 4 total attempts (initial + 3 retries) with 5-second intervals before throwing RATE_LIMITED. Retrying on 429 errors without respecting rate limit signals can exacerbate rate limiting and violate HTTP semantics. The retry logic should skip retries for 4xx client errors, particularly 429.
Description
fetchProjectConfigs,fetchAllowedOriginsandfetchProjectLimitsType of change
Checklist
Note
Introduce a reusable retry helper and apply 3x/5s retries to project config, usage limits, and allowed origins requests, with expanded tests and error handling.
withRetrieshelper to retry async operations.fetchProjectConfig,fetchUsage(/appkit/v1/project-limits), andfetchAllowedOriginswith retries (intervalControllersConstantsUtil.FIVE_SEC_MS, max 3).fetchAllowedOrigins: map 429 toRATE_LIMITED, 5xx toSERVER_ERROR, otherwise return[].Written by Cursor Bugbot for commit 3b59780. This will update automatically on new commits. Configure here.