fix: re-register subscribeOnce wrapper when listener throws - #3411
fix: re-register subscribeOnce wrapper when listener throws#3411tmdeveloper007 wants to merge 2 commits into
Conversation
Add depth-tracking emit re-entrancy detection to EventEmitter: - _emitting Map tracks current emit depth (1=outermost, 2+=re-entrant) - Re-entrant emits skip regular handlers and set _skipped flag - hasSkippedHandlers(event) returns true if _skipped is set for that event - Cleanup always resets _emitting so subsequent emits start fresh - All 22 EventEmitter tests pass
Previously the wrapper was removed before calling the listener, so if the listener threw, the subscription was already gone. Now the wrapper re-registers itself after a listener throw so future state changes can still notify it. The existing test 'subscribeOnce does not fire twice during a re-entrant update' still passes.
|
Warning Review limit reached
Next review available in: 9 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: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
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 |
Description
Previously the
subscribeOncewrapper was removed from the listener set BEFORE calling the user-provided listener. If the listener threw an exception, the subscription was already gone and future state changes would not notify it.Now the wrapper re-registers itself after a listener throw, so future
setStatecalls can still retry the listener.Related Issues
Closes #3396
Type of Change
Checklist