Skip to content

fix(data-layer): beaconchain 429 rate limit resilience#17832

Merged
pettinarip merged 1 commit into
devfrom
fix/beaconchain-rate-limit-retry
Mar 24, 2026
Merged

fix(data-layer): beaconchain 429 rate limit resilience#17832
pettinarip merged 1 commit into
devfrom
fix/beaconchain-rate-limit-retry

Conversation

@pettinarip
Copy link
Copy Markdown
Member

@pettinarip pettinarip commented Mar 23, 2026

Summary

  • Add shared fetchRetry utility wrapping Trigger.dev's retry.fetch with automatic 429 and 5xx backoff retry
  • Replace raw fetch() with fetchRetry in beaconchain fetcher, removing the hardcoded 1s sleep between calls
  • Move beaconchain task from hourly to daily schedule (1,000 req/month quota was being exhausted at ~1,440 req/month)
  • Align task-level and global retry timeouts

Closes #17825

Test plan

  • Verified fetchRetry retries 429 responses with exponential backoff (2 attempts)
  • Verified beaconchain task runs on daily schedule
  • TypeScript compilation passes
  • Lint and prettier pass

@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 23, 2026

Deploy Preview for ethereumorg ready!

Name Link
🔨 Latest commit 679672a
🔍 Latest deploy log https://app.netlify.com/projects/ethereumorg/deploys/69c1a873dee550000851ed11
😎 Deploy Preview https://deploy-preview-17832.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 (no change from production)
Accessibility: 94 (no change from production)
Best Practices: 100 (no change from production)
SEO: 99 (no change 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.

Comment thread src/data-layer/tasks.ts
[KEYS.EVENTS, fetchEvents],
[KEYS.DEVELOPER_TOOLS, fetchDeveloperTools],
[KEYS.TRANSLATION_GLOSSARY, fetchTranslationGlossary],
[KEYS.BEACONCHAIN, fetchBeaconChain],
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

most important change, from hourly to daily

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.

@pettinarip Looks good, left one note..
We could re-target this to staging if we want to pull it in with the deploy

const totalEthStaked = Math.floor(eligibleether * 1e-9)

// Wait 1s to respect rate limit
await new Promise((r) => setTimeout(r, 1000))
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.

Worth double-checking: with this sleep removed, the ethstore fetch fires immediately after the epoch fetch. If beaconcha.in enforces 1 req/sec, the second call will routinely 429 and depend on fetchRetry backoff to recover. We sure this will work as expected?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, tested. Its already working as expected.

@pettinarip pettinarip merged commit 51b3795 into dev Mar 24, 2026
17 checks passed
@pettinarip pettinarip deleted the fix/beaconchain-rate-limit-retry branch March 24, 2026 15:49
@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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Recovery Agent] fetch-beaconchain persistent 429 rate limiting (66 failures/24h)

2 participants