Files
worldmonitor/api/cron
Elie Habib 8b02ec599f feat(aviation): add Vercel cron to pre-warm AviationStack cache (#776)
16,710 AviationStack requests/day instead of expected ~1,368. Root
cause: when 2h Redis cache expires, multiple Vercel Edge instances
each independently fire 114 API calls (inflight coalescing is
process-local). Fix: cron job writes to Redis every 2h with 4h TTL,
so user requests always hit cache.

- New api/cron/warm-aviation-cache.ts (edge runtime, CRON_SECRET auth)
- Three independent sources: FAA, AviationStack (intl), NOTAM
- Unhealthy AviationStack responses skip cache write to preserve data
- vercel.json: crons array at "0 */2 * * *"
- Expected reduction: 16,710 → ~1,368 requests/day (92%)
2026-03-02 18:10:46 +04:00
..