Skip to content

fix(conflicts): /api/conflicts times out and returns no data - #219

Open
BenJule wants to merge 1 commit into
simplifaisoul:masterfrom
BenJule:fix/conflicts-feed-timeout
Open

fix(conflicts): /api/conflicts times out and returns no data#219
BenJule wants to merge 1 commit into
simplifaisoul:masterfrom
BenJule:fix/conflicts-feed-timeout

Conversation

@BenJule

@BenJule BenJule commented Jun 27, 2026

Copy link
Copy Markdown

Summary

/api/conflicts returns nothing — the conflict layer is always empty.

The route fetches from GDELT with three queries run sequentially, each spaced 6s apart (GDELT rate-limits to ~1 query/5s), plus an extra 6s delay before the per-query DOC-API fallback. In the worst case that's roughly 90s, which is well past the client/proxy timeout, so the endpoint times out and the frontend gets no data at all.

Fix

  • Collapse the three queries into a single combined query (airstrike OR missile OR shelling OR bombing OR frontline OR drone strike OR war casualties).
  • Reduce the DOC-fallback spacing from 6s to 1.5s.

The route now completes in ~10–15s and actually returns conflict events. Coverage is comparable since GDELT scores the same corpus regardless of how the OR-terms are split.

Test

Built and deployed; GET /api/conflicts went from a hard timeout (no response) to 200 with populated zones/events in ~14s. (I run this behind a short nginx cache so repeat loads are instant.)

Note (separate issue)

/api/air-quality is also empty because it calls the deprecated OpenAQ v2 API (/v2/latest). v2 has been sunset; v3 needs an API key and a different response shape. Happy to send a follow-up PR for that if you'd like the v3 migration.

The conflicts feed ran three GDELT queries sequentially, each spaced 6s apart
(GDELT allows ~1 query/5s), plus an extra 6s delay before the per-query DOC
fallback. Worst case that is ~90s, which exceeds the client/proxy timeout, so
/api/conflicts returned nothing at all (the layer was always empty).

Use a single combined query and cut the DOC-fallback spacing to 1.5s, so the
route completes in ~10-15s and actually returns conflict events.
@vercel

vercel Bot commented Jun 27, 2026

Copy link
Copy Markdown

@BenJule is attempting to deploy a commit to the Amanda's projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants