Skip to content

fix(backend): handle 429 rate limit responses with retry-after delay (closes #307) - #330

Open
ghzhost wants to merge 1 commit into
SmartDropLabs:mainfrom
ghzhost:fix/backend-rate-limit-handling
Open

fix(backend): handle 429 rate limit responses with retry-after delay (closes #307)#330
ghzhost wants to merge 1 commit into
SmartDropLabs:mainfrom
ghzhost:fix/backend-rate-limit-handling

Conversation

@ghzhost

@ghzhost ghzhost commented Sep 4, 2026

Copy link
Copy Markdown

Summary of Changes

  • Detect 429 Status in request(): Inspects response status code for 429 Too Many Requests, extracts Retry-After header or JSON body details (retry_after_seconds), and sets a user-friendly error message indicating the cooldown period.
  • Support retryAfterSeconds in BackendApiError: Added optional retryAfterSeconds field to BackendApiError to preserve rate limit duration.
  • Update isRetryableBackendError: 429 rate-limited queries are transient and retryable once the rate limit window resets.
  • Dynamic backendQueryRetry.retryDelay: TanStack Query retry policy utilizes retryAfterSeconds (clamped up to 30s) for 429 errors when available instead of default backoff.
  • Unit Tests: Added test coverage in src/lib/backend.retry.test.ts for 429 error detection, retryability, and retryAfterSeconds delay calculation.

Closes #307

@netlify

netlify Bot commented Sep 4, 2026

Copy link
Copy Markdown

Deploy Preview for spiffy-melomakarona-eb1e8a ready!

Name Link
🔨 Latest commit 1c2b21b
🔍 Latest deploy log https://app.netlify.com/projects/spiffy-melomakarona-eb1e8a/deploys/6a9b5b6416a0ce00085ca7e8
😎 Deploy Preview https://deploy-preview-330--spiffy-melomakarona-eb1e8a.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Sep 4, 2026

Copy link
Copy Markdown

Deploy Preview for smart-drop ready!

Name Link
🔨 Latest commit 1c2b21b
🔍 Latest deploy log https://app.netlify.com/projects/smart-drop/deploys/6a9b5b64fb602e0008822b0b
😎 Deploy Preview https://deploy-preview-330--smart-drop.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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.

No API rate limit handling in backend.ts

1 participant