Skip to content

fix(aviation): prevent AviationStack API quota blowout#623

Merged
koala73 merged 1 commit into
mainfrom
fix/aviation-quota-blowout
Mar 1, 2026
Merged

fix(aviation): prevent AviationStack API quota blowout#623
koala73 merged 1 commit into
mainfrom
fix/aviation-quota-blowout

Conversation

@koala73

@koala73 koala73 commented Mar 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • Thundering herd fix: Replace manual getCachedJson/setCachedJson with cachedFetchJson for intl delays — concurrent cache misses now coalesce into a single fetch instead of each independently firing 93 API calls
  • Redis TTL: 30min → 2h
  • Frontend polling: 10min → 2h (was re-fetching 12x more often than needed)
  • Circuit breaker cache: 5min → 2h
  • CDN edge tier: medium (5min s-maxage) → static (1h s-maxage)
  • Cache key bump: intl:v2intl:v3 to force fresh entry

Root cause

Each cache miss triggered 93 individual AviationStack API calls (one per non-US airport). With 10-min frontend polling, 5-min circuit breaker, 5-min CDN edge cache, and thundering herd vulnerability — multiple concurrent users could fire thousands of calls/day.

Impact

  • Before: ~4,500+ API calls/day (single user), thundering herd multiplied by concurrent users
  • After: ~93 calls per 2h = ~1,116 calls/day max, with CDN + circuit breaker reducing actual hits further

Supersedes #617 (which only bumped Redis TTL).

Test plan

  • tsc --noEmit passes
  • Verify aviation data loads on worldmonitor.app after deploy
  • Monitor AviationStack dashboard for reduced API calls

- Replace manual getCachedJson/setCachedJson with cachedFetchJson for
  intl delays — prevents thundering herd (concurrent misses each firing
  93 API calls independently)
- Bump Redis cache TTL from 30min to 2h
- Bump frontend polling from 10min to 2h to match server cache
- Bump circuit breaker browser cache from 5min to 2h
- Bump CDN edge tier from medium (5min) to static (1h)
- Bump cache key to v3 to force fresh entry with new TTL
@vercel

vercel Bot commented Mar 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
worldmonitor Building Building Preview, Comment Mar 1, 2026 0:58am
worldmonitor-finance Building Building Preview, Comment Mar 1, 2026 0:58am
worldmonitor-happy Building Building Preview, Comment Mar 1, 2026 0:58am
worldmonitor-startup Building Building Preview, Comment Mar 1, 2026 0:58am

Request Review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@koala73
koala73 merged commit bf432ef into main Mar 1, 2026
6 checks passed
koala73 added a commit that referenced this pull request Mar 1, 2026
- Replace manual getCachedJson/setCachedJson with cachedFetchJson for
  intl delays — prevents thundering herd (concurrent misses each firing
  93 API calls independently)
- Bump Redis cache TTL from 30min to 2h
- Bump frontend polling from 10min to 2h to match server cache
- Bump circuit breaker browser cache from 5min to 2h
- Bump CDN edge tier from medium (5min) to static (1h)
- Bump cache key to v3 to force fresh entry with new TTL
matthewvecchione1-ops pushed a commit to matthewvecchione1-ops/worldmonitor that referenced this pull request Mar 4, 2026
- Replace manual getCachedJson/setCachedJson with cachedFetchJson for
  intl delays — prevents thundering herd (concurrent misses each firing
  93 API calls independently)
- Bump Redis cache TTL from 30min to 2h
- Bump frontend polling from 10min to 2h to match server cache
- Bump circuit breaker browser cache from 5min to 2h
- Bump CDN edge tier from medium (5min) to static (1h)
- Bump cache key to v3 to force fresh entry with new TTL
@koala73
koala73 deleted the fix/aviation-quota-blowout branch March 4, 2026 19:40
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