fix(gdelt): stop retrying 429 over http, back off instead of tracebacking #69

Merged
sirius merged 1 commit from fix/gdelt-429-backoff into master 2026-11-21 23:13:19 +00:00

2026-11-21

Sirius DevOps
fix(gdelt): stop retrying 429 over http, add quota backoff
GDELT's DOC 2.0 API answers 429 with a plain-text body, no Retry-After, and
a per-IP block window that widens with request volume. The https->http retry
only doubled the request count against that quota and could never succeed,
and every cycle logged a full traceback.

- ingest_gdelt: a 429 (or a 200 with a prose body) now sets a backoff window
  (GDELT_BACKOFF_BASE=300s, doubling to GDELT_BACKOFF_MAX=1800s, Retry-After
  honoured when present) and returns 0 instead of raising.
- cycles inside the window skip the call entirely, logging one line.
- the https->http fallback now only covers TransportError (TLS/connect), not
  HTTP error statuses.
- producer_loop logs a GDELT failure as one WARNING line, no traceback.
- tests/test_gdelt_backoff.py covers no-retry-on-429, cooldown skip, doubling
  and cap, Retry-After, 200-prose, success reset, transport fallback.
2026-11-21 18:12:56 -05:00