perf: paginate and throttle clearLocal checkpoint deletion#268
Conversation
|
Warning Review limit reached
Next review available in: 56 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: Organization UI 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 |
clearLocal fetched all _local docs at once (one checkpoint doc exists per client replication, so this can be large) and fired every DELETE in parallel via Promise.all - momentarily flooding CouchDB on big deployments, and rejecting wholesale on the first failure while the remaining deletes kept running detached. Now: - _local_docs is fetched in pages of 500 (deleted docs disappear from the index, so re-fetching pages through the remainder) - deletes run with bounded concurrency (10 in flight) - failures are logged, all docs are still attempted, and a summary error is thrown at the end (endpoint still reports failure) Part of #261 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
846ead0 to
15ed83d
Compare
Page forward through _local_docs by id cursor so undeletable docs cannot block progress to later pages, and drop the unbounded attemptedIds set.
Summary
Part of #261 (item 7). Based on #262 (e2e suite) — merge that first; GitHub retargets automatically. Independent of the other improvement PRs.
clearLocal(triggered on every permission change and via/admin/clear_local/:db) fetched all_localdocs in one buffered response — one replication checkpoint doc exists per client, so large deployments have thousands — and fired every DELETE in parallel viaPromise.all. That momentarily floods CouchDB, and a single failure rejected the whole operation while the remaining deletes kept running detached.Changes
_local_docsis fetched in pages of 500; since deleted docs disappear from the index, re-fetching naturally pages through the remainder (an attempted-ids set guards against endless loops on undeletable docs).Test plan
clear_localtests unchanged and green🤖 Generated with Claude Code