Skip to content

feat: fetcher reads retry_after from body when Cloudflare returns retry-after:0#148

Open
kribor wants to merge 1 commit into
mainfrom
feat/fetcher-cloudflare-retry-after-body
Open

feat: fetcher reads retry_after from body when Cloudflare returns retry-after:0#148
kribor wants to merge 1 commit into
mainfrom
feat/fetcher-cloudflare-retry-after-body

Conversation

@kribor

@kribor kribor commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Cloudflare 429 responses set retry-after: 0 in the HTTP header but encode the actual delay (e.g. 30 s) in the JSON body as retry_after
  • Previously, a header value of 0 fell through to exponential backoff, causing premature retries
  • Now getRetryTimeout checks res.body.retry_after for any 429/503 where the header-based timeout resolves to ≤ 0

Test plan

  • New test retryAfter cloudflare body covers the Cloudflare pattern: retry-after: 0 header + { retry_after: 2 } in body
  • Existing retryAfter and retryAfter date tests continue to pass

…ry-after:0

Cloudflare 429 responses set retry-after:0 in the header but encode the
actual delay (e.g. 30 s) in the JSON body as retry_after. The header
value parses to 0, which previously fell through to exponential backoff
and caused premature retries. Now we check res.body.retry_after for any
429/503 where the header-based timeout is ≤ 0.
@kribor kribor requested a review from kirillgroshkov as a code owner June 13, 2026 15:19
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