fix(cdn): bound goroutine fan-out and add per-request timeout - #37
Conversation
The CDN resolver created a fresh semaphore per recursion level, allowing 10^depth concurrent goroutines for deep dependency trees. Share a single semaphore across all depths, acquiring it only for HTTP work and releasing before spawning children to prevent deadlock. Add WithRequestTimeout for per-request context deadlines on registry and CDN fetch calls, and WithConcurrency to configure the shared limit. Extract clone() to eliminate field-list duplication across With* builders, using slices.Clone for slice fields to prevent aliasing. Closes #34, closes #35 Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (20)
✨ 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. Review rate limit: 0/1 reviews remaining, refill in 29 minutes and 34 seconds.Comment |
Build Artifacts
Built from d67590a @ fix/cdn-concurrency-timeout |
Summary
WithRequestTimeoutfor per-request context deadlines on registry and CDN fetch callsWithConcurrencyto configure the shared goroutine limit (default 10)selecton semaphore acquisition to respect context cancellationclone()method to eliminate field-list duplication across 8With*builders, withslices.Clonefor slice fieldsCloses #34, closes #35
Test plan
TestSharedSemaphoreBoundsConcurrency-- verifies max concurrent goroutines stay within configured limitTestSharedSemaphoreNoDeadlockMultiDepth-- regression test with concurrency=2 and multi-level transitive deps (would deadlock with old per-level semaphore)TestRequestTimeoutCancelsSlowFetch-- verifies slow CDN fetch is cancelled by timeoutTestRequestTimeoutDefaultIsNoTimeout-- verifies default (no timeout) works correctlyTestContextCancellationStopsSemAcquisition-- verifies goroutines respect context cancellation while waiting for semaphore slotsTestWithConcurrencyDefaultandTestWithConcurrencyIgnoresZero-- builder defaultsmake lint && make test)