fix(ocm): serialise OCM requests via a global concurrency gate (stop the 429 storm)#89
Conversation
v1.10.1 made every large country tile, and at startup ~6 of them (US, DE, FR, GB, IT, NL) tiled concurrently and flooded OCM's shared rate limit — an escalating 429 storm (Retry-After climbing to 10s) that left the US scrape partial (hit its time budget at 518 requests) and risks OCM throttling the shared API key. Add a module-level concurrency gate shared across all OCM scrapers (PUMPERLY_OCM_MAX_CONCURRENCY, default 1) so requests serialise instead of competing. The slot is held across a request's 429 backoff so backpressure is global (pauses all OCM traffic to let the limit recover). Because a country now spends much of its wall-clock waiting its turn, the per-country time budget switches from wall-clock to ACTIVE fetch time (slot-held duration) so a country is bounded by its own work, not by waiting — otherwise a country that waited would starve and go partial with almost no requests. Verified live: the v1.10.1 fix already captured downtown Portland (corridor 4 -> 236, Broadway Tower Garage + Fox Tower Supercharger now present); this change makes big countries complete fully and stops the 429 storm. Refs #85, #87.
|
Warning Review limit reached
Next review available in: 54 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem
The v1.10.1 tiling fix works (downtown Portland now covered — corridor 4 → 236), but it made every large country tile, and at startup ~6 of them (US, DE, FR, GB, IT, NL) tile concurrently and flood OCM's shared rate limit. Observed live on the v1.10.1 deploy:
Retry-Afterclimbing to 10 s across DE/GB/IT/US.Fix
PUMPERLY_OCM_MAX_CONCURRENCY, default 1) shared across every OCM scraper via module-level state, so requests serialise instead of competing for the rate limit. The slot is held across a request's 429 backoff, so backpressure is global — a rate-limit pauses all OCM traffic and lets the shared limit recover, rather than firing the next country straight into another 429.Validation
maxInFlight === 1).Trade-off
Serial OCM requests make the full daily OCM sweep take ~15–20 min (background, staggered) — deliberately polite to a free community API. Tunable via
PUMPERLY_OCM_MAX_CONCURRENCYif more speed is ever needed.Refs #85, #87.