fix: batch pr_issue_links backfill to avoid event-loop stall#210
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds pnpm workspace ChangesWorkspace and async paginated backfill
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
src/lib/refresh.tsESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox. Warning Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption. 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pnpm-workspace.yaml`:
- Around line 1-4: The allowBuilds map currently contains invalid string
placeholders; replace the placeholder values for the package matchers
better-sqlite3, sharp, and unrs-resolver with boolean literals (true or false)
so they become valid pnpm allowBuilds entries (e.g., set better-sqlite3: true,
sharp: false, unrs-resolver: true or whatever policy you intend) — update the
values in the allowBuilds block to use true/false for those three keys.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 3400aa43-9c8a-4980-aafb-c6b3dd4be2d5
📒 Files selected for processing (2)
pnpm-workspace.yamlsrc/lib/refresh.ts
|
Hi,@MkDev11 |
…promises lint rule
|
please remove |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
runPrIssueLinksBackfill()was executing a single monolithicbetter-sqlite3transaction over every PR in a repo, holding the DB writer connection for the entire duration. On large repos (1 000+ PRs) this blocked the Node.js event loop for 30–60+ seconds, causing Cloudflare 524 timeouts on concurrent requests.The function is now async and processes PRs in batches of 200. Each batch commits its own transaction and then yields the event loop via
await yieldEventLoop()before the next batch, keeping the writer lock held for only a bounded window at a time. ThesetImmediatewrapper inbackfillPrIssueLinksIfNeeded()is updated toasyncso it correctlyawaits the batched loop before writing the completion marker and cleaning upinFlightLinksBackfill.Related Issues
Fixes #209
Type of Change
Testing
pnpm buildpassesChecklist
yieldEventLoop,persistInChunkspattern already used elsewhere)Summary by CodeRabbit
Chores
Refactor