Skip to main content

DEFAULT_EVENTS_CHANNEL_CAPACITY

Constant DEFAULT_EVENTS_CHANNEL_CAPACITY 

Source
pub const DEFAULT_EVENTS_CHANNEL_CAPACITY: usize = 1024;
Expand description

Default capacity of the internal channel from the reader task to EventStream, used by CodexAppServerClient::spawn, CodexAppServerClient::connect_streams, and CodexAppServerClient::connect_unix. Bounded (rather than unbounded) so a stalled or absent consumer grows memory by a fixed amount, not without bound, if events keep arriving faster than EventStream::recv is called - see that type’s doc comment for the drop policy once this fills up.

Override per-connection with CodexAppServerClient::spawn_with_events_capacity, CodexAppServerClient::connect_streams_with_events_capacity, or CodexAppServerClient::connect_unix_with_events_capacity - REST/SSE consumers reading events over a network are exactly the “slow consumer” case this bound protects against, so crate::rest::RestLimits threads its own per-session override through crate::SessionOptions::with_events_capacity instead of hardcoding this default for every session it spawns.