perf(daemon): early-out in note_output_sent_to_local_receivers when no deadlines/breakers - #2845
Conversation
…o deadlines/breakers `note_output_sent_to_local_receivers` runs on every `OutputSent` message. Its per-receiver loop has two possible effects: refreshing an input deadline (only when `input_deadlines` is non-empty) and circuit-breaker recovery (only when `broken_inputs` is non-empty). Both inner branches already guard on those maps being non-empty. In the common case where neither `input_timeout` deadlines nor circuit breakers are configured, the whole loop is a no-op — yet the function still did an `Instant::now()` clock read and a `subscribe_channels` lookup plus a channel-capacity check for every receiver, on every message. Add a single early return when both maps are empty, skipping the clock read and the entire loop. Behavior is unchanged: the loop had no observable effect in that case. Validation: `cargo test -p dora-daemon` (including the existing `note_output_sent` recovery tests, which configure `broken_inputs` and so still exercise the loop), `cargo clippy`, and `cargo fmt --check` pass. This change was generated by Claude (Claude Code), an AI assistant. It is machine-generated and should be reviewed carefully before merging. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D2eu6P1CvTvoKdK9fK3ZSd
|
😎 Merged successfully - details. |
No issues found. I traced the full body of Generated by Claude Code |
Issue
note_output_sent_to_local_receiversruns on everyOutputSentmessage (the per-output notification). Its per-receiver loop has two possible effects:input_deadlinesis non-empty, andbroken_inputsis non-empty.Both inner branches already guard on those maps being non-empty. But in the common case where neither
input_timeoutdeadlines nor circuit breakers are configured, the whole loop is a no-op — yet the function still did anInstant::now()clock read and, for every receiver, asubscribe_channelslookup plus a channel-capacity check, on every message.Fix
Add a single early return at the top of the function when both
input_deadlinesandbroken_inputsare empty, skipping the clock read and the entire loop. Behavior is unchanged: the loop had no observable effect in that case.Validation
cargo test -p dora-daemonpasses, including the existingnote_output_sentrecovery tests — those configurebroken_inputs, so they still exercise the loop past the new guard.cargo clippy ... -D warningsandcargo fmt --all --checkpass.🤖 Generated with Claude Code
https://claude.ai/code/session_01D2eu6P1CvTvoKdK9fK3ZSd
Generated by Claude Code