keep-desktop: split frost_event_listener into per-family node-event handlers#823
Conversation
|
Warning Review limit reached
Next review available in: 3 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 (1)
✨ 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 |
frost_event_listenerhad grown to ~340 lines: aselect!loop whose event branch carried a ~30-armKfpNodeEventmatch (logging + UI-queue pushes) alongside the sign-request rate-limit branch. This splits it into focused handlers.Changes
frost_event_listener(340 → 35 lines) is now just the loop andselect!, delegating each branch.handle_sign_requestholds the rate-limit + pending-request-enqueue branch, returningControlFlow(Break on channel close, Continue on rate-limit rejection).handle_node_eventcomputesnow_secs, mapsRecvError(Lagged → Continue, Closed → Break), and dispatches the event. Itsmatchlists everyKfpNodeEventvariant with no_catch-all, so exhaustiveness stays compiler-enforced: a new event variant will fail to compile until it is handled.@-bindings:handle_peer_signing_node_event,handle_descriptor_node_event/handle_descriptor_status_node_event/handle_descriptor_health_node_event, andhandle_psbt_node_event/handle_psbt_status_node_event. The inlinelog!macro was replaced with directpush_log(...)calls.Every resulting function is under 100 lines.
Behavior
Pure code motion. Arm bodies are verbatim (only
log!(a, b)→push_log(frost_events, now_secs, a, b), and the extra&dropped where helper params are already references). Event ordering, logging, UI-queue pushes, and the rate-limit / pending-request logic are unchanged.Verification
cargo clippy -p keep-desktop --all-targets: clean.