feat(bedesten): client-side rate limiter with 429 back-pressure
Probed the live API (2026-05-08): the per-IP limit is 10 requests in a rolling 30s window, with HTTP 429 + Retry-After: 30 on the 11th call. Add a token bucket inside BedestenApiClient (default capacity=1, refill 1 token / 3.5s — strict serialization, no burst) so we stay below the threshold by default. When the server still returns 429 (e.g. the egress IP is shared with other clients), pause the whole bucket for the Retry-After window so queued in-flight requests wait gracefully instead of hammering. Tunable via BEDESTEN_RATE_CAPACITY / BEDESTEN_RATE_REFILL_S. Verified: 14 concurrent requests after a clean cooldown -> 13 OK, 1 stray 429 (bucket auto-paused 22.5s, then drained cleanly). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
4521e1de85
commit
58457b076f
@@ -473,7 +473,7 @@ doc8 = await get_kvkk_document_markdown(decision_url="https://www.kvkk.gov.tr/Ic
|
||||
|
||||
| API | Rate Limit | Notes |
|
||||
|-----|------------|-------|
|
||||
| Bedesten Unified | Unknown | Ministry of Justice API - no documented limits |
|
||||
| Bedesten Unified | ~10 req / 30s window per source IP (measured 2026-05-08); 11th req → HTTP 429 with `Retry-After: 30`. Client uses an internal token bucket (default 1 token, refill 1/3.5s) plus 429 back-pressure (whole bucket pauses for the Retry-After window). Override via `BEDESTEN_RATE_CAPACITY` / `BEDESTEN_RATE_REFILL_S`. |
|
||||
| Yargıtay Primary | Unknown | Official government API |
|
||||
| Danıştay | Unknown | Official government API |
|
||||
| Anayasa Mahkemesi | Unknown | Constitutional Court API |
|
||||
|
||||
Reference in New Issue
Block a user