fix(gdelt): stop retrying 429 over http, back off instead of tracebacking #69
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/gdelt-429-backoff"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Symptom
deploy/osint-ingesterlogged a full traceback on every producer cycle (17:19, 17:24, 18:01 local, and 14 times in 12h):USGS/EONET/CISA KEV/FIRMS in the same cycle returned 200.
What the quota actually looks like (measured 2026-11-21)
GET https://api.gdeltproject.org/api/v2/doc/doc?...from three independent egress paths (ingester pod on linode10.244.2.0/16, the linode host itself, home/137.118.156.124) returns429with bodyPlease limit requests to one every 5 seconds ...and noRetry-Afterheader.GDELT -> 50 articlesat 17:35, 17:46 local; 634gdel-t2events in the DB), roughly 1 cycle in 5-6. Every failure was charged twice by the https->http retry.200with a prose body is the documented GDELT error style too, so a naiveresp.json()can throw on a throttle.Change
app/sources.py:ingest_gdelt429(or200+ non-JSON body): set a backoff window andreturn 0instead of raising.GDELT_BACKOFF_BASE(300s) doubling per consecutive throttle up toGDELT_BACKOFF_MAX(1800s);Retry-After(Δ-seconds or HTTP-date) honoured when present.httpx.TransportError(TLS/connect, the expired-cert case it was written for), never an HTTP error status.app/run_ingester.py:producer_looplogs a GDELT failure as a singleWARNING, no traceback.tests/test_gdelt_backoff.py: 7 unit tests (no retry on 429, cooldown skip, doubling+cap, Retry-After, 200-prose, success resets, transport fallback still works).Verification
pytest tests/test_gdelt_backoff.py tests/test_event_ingest.py -q-> 13 passed.Full suite: 416 passed, 10 pre-existing failures unrelated to this diff (
test_news_scraperneeds a scraper dep not in the app image;test_hud_chrome/test_geofencefail identically on unmodified master).Live proof in the cluster follows the image build (pin
amd64-<sha12>in homek8s): 3 consecutive cycles with a singleGDELT 429 ... backing off until <ts>line and no traceback.