Skip to content

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

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

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

Conversation

@koala73
Copy link
Owner

@koala73 koala73 commented Mar 1, 2026

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
Copy link

vercel bot commented Mar 1, 2026

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

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
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