Push queues and connection actors

Updated Nov 29, 2025

Background work interacts with connections through PushQueues. The fluent builder configures high- and low-priority capacities, optional rate limits, and an optional dead-letter queue with tunable logging cadence for dropped frames.[^23] Queue construction validates capacities and rate limits, clamping rates to the supported range.[^24] PushHandle exposes async push_high_priority and push_low_priority helpers that honour the rate limiter before awaiting channel capacity, while try_push implements policy-controlled drops with optional warnings and dead-letter forwarding.[^26] Cloneable handles downgrade to Weak references for registration in a session registry.[^25]

PushQueues::recv prefers high-priority frames but eventually drains the low-priority queue; close lets tests release resources when no actor is running.[^27] The connection actor consumes these queues, an optional streaming response, and a cancellation token.

FairnessConfig and FairnessTracker limit consecutive high-priority frames and optionally enforce a time slice. Resetting the tracker after low-priority work keeps fairness predictable.[^28][^29] ConnectionActor::run polls the shutdown token, push queues, and response stream using a biased select! loop, invokes protocol hooks, records metrics for outbound frames, and returns a WireframeError when the response stream hits an I/O problem.[^30][^33] Active connection counts are tracked with a guard that increments on creation and decrements on drop; the active_connection_count() helper exposes the current gauge.[^31]