fix(worker-pool): clear parse timeouts so --full exits promptly#146
Conversation
Promise.race with uncancellable delay() left 120s timers on the event loop after workers finished. Replace with explicit setTimeout + clearTimeout on worker response and dispose.
🦋 Changeset detectedLatest commit: 09501e0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Warning Review limit reached
More reviews will be available in 44 minutes and 40 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, 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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
✨ 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 |
Review follow-up: in-process wall time did not catch orphaned event-loop timers. Spawn a child that runs parseFilesParallel and assert it exits in <5s. Export INLINE_PARSE_MAX for fixture gate; remove unused delay().
Race child exit against 6s and kill on hang so regressions fail with a clear assertion instead of burning the full test timeout.
Drop redundant 5s elapsed assertion; hang race is the regression signal. Wrap Node dist --full smoke in timeout 45 so a timer leak fails CI fast.
Stop exporting INLINE_PARSE_MAX; mirror the threshold in tests. Add node dist --full subprocess exit regression (skips when dist/ absent).
Summary
Promise.race+ uncancellabledelay()increateParseWorkerSession().parse()with a singlesetTimeoutcleared on worker message, error, ordispose().--fullruns despite ~1s index work).parseFilesParallel()on >12 files must return in <5s wall time.docs/architecture.md§ Worker thread parallelism.Test plan
bun test src/worker-pool.test.tsbun run typechecktime bun src/index.ts --full— exits in ~1s (was ~120s tail)