Skip to content

Refactor all fetchers to use fetchRetry#17850

Merged
wackerow merged 1 commit into
devfrom
refactor/fetchers-use-fetch-retry
Mar 26, 2026
Merged

Refactor all fetchers to use fetchRetry#17850
wackerow merged 1 commit into
devfrom
refactor/fetchers-use-fetch-retry

Conversation

@pettinarip
Copy link
Copy Markdown
Member

@pettinarip pettinarip commented Mar 25, 2026

Summary

  • Replace plain fetch() with fetchRetry() across all 26 data-layer fetchers for automatic retry on transient HTTP errors (408, 409, 429, 500-599)
  • Remove custom retry() wrapper usage in fetchGitHub and fetchNpmJs, consolidating retry logic into the shared fetchRetry utility
  • Delete the now-unused src/lib/utils/fetch.ts (old retry/sleep utilities)
  • Add per-caller override support to fetchRetry for custom retry strategies (e.g. "headers" strategy for APIs with Retry-After)

Details

  • fetchRetry wraps Trigger.dev's retry.fetch with exponential backoff (3 attempts) on 408, 409, 429, and 500-599
  • GitHub-specific 403 rate-limit handling preserved in fetchGitHubContributors and fetchGitHistory (GitHub uses 403, not 429)
  • Inter-batch pacing delays preserved where they existed (GitHub GraphQL 1s, npm 15s)
  • sleep utility exported from fetchRetry.ts for shared use

Test plan

  • TypeScript compiles cleanly (npx tsc --noEmit)
  • ESLint + Prettier pass (via pre-commit hooks)
  • Verify fetchers succeed in Trigger.dev dev environment
  • Monitor first production run for any regression in data fetching

@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 25, 2026

Deploy Preview for ethereumorg ready!

Name Link
🔨 Latest commit 6e8424b
🔍 Latest deploy log https://app.netlify.com/projects/ethereumorg/deploys/69c3ff85c53c020008e5565b
😎 Deploy Preview https://deploy-preview-17850.ethereum.it
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
7 paths audited
Performance: 56 (🟢 up 4 from production)
Accessibility: 94 (no change from production)
Best Practices: 100 (no change from production)
SEO: 98 (🔴 down 1 from production)
PWA: 59 (no change from production)
View the detailed breakdown and full score reports

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

@github-actions github-actions Bot added the tooling 🔧 Changes related to tooling of the project label Mar 25, 2026
Copy link
Copy Markdown
Member

@wackerow wackerow left a comment

Choose a reason for hiding this comment

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

Looks good!

Comment on lines +20 to +22
/** Sleep for specified milliseconds. */
export const sleep = (ms: number) =>
new Promise((resolve) => setTimeout(resolve, ms))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could consider leaving this back in the fetch util, unless it needs to be inside data-layer dir.. not a blocker

@wackerow wackerow merged commit 0831a89 into dev Mar 26, 2026
11 checks passed
@wackerow wackerow deleted the refactor/fetchers-use-fetch-retry branch March 26, 2026 02:06
@pettinarip pettinarip mentioned this pull request Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tooling 🔧 Changes related to tooling of the project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants