#[non_exhaustive]pub struct RealtimeConfig {
pub max_concurrent_reexecutions: usize,
pub resync_interval: DurationStr,
pub postgres_change_buffer_size: usize,
pub debounce_quiet_window: DurationStr,
pub debounce_max_wait: DurationStr,
pub sse_max_sessions: usize,
pub subscription_max_per_session: usize,
pub shard_count: usize,
pub max_sessions_per_user: usize,
pub max_sessions_per_ip: usize,
pub max_subscriptions_per_user: usize,
pub max_cached_result_bytes: usize,
}Expand description
Configuration for the real-time subscription engine and SSE transport.
All fields have production-safe defaults; only set these to tune behaviour.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.max_concurrent_reexecutions: usizeMaximum concurrent query re-executions during an invalidation flush.
resync_interval: DurationStrPeriodic resync interval. Re-evaluates every active query group to recover from dropped NOTIFY payloads. “0s” disables the sweep (e.g. “60s”, “5m”).
postgres_change_buffer_size: usizeBroadcast channel buffer for raw change notifications from PG.
debounce_quiet_window: DurationStrDebounce quiet window duration. Changes arriving within this window are coalesced into a single flush (e.g. “50ms”, “100ms”).
debounce_max_wait: DurationStrAbsolute maximum debounce wait before forcing a flush (e.g. “200ms”, “1s”).
sse_max_sessions: usizeMaximum concurrent SSE sessions across all clients.
subscription_max_per_session: usizeMaximum subscriptions per SSE session.
shard_count: usizeNumber of DashMap shards for the subscription manager. Higher values reduce lock contention at the cost of memory.
max_sessions_per_user: usizeMaximum concurrent SSE sessions per authenticated user.
Interacts with subscription_max_per_session and max_subscriptions_per_user:
the effective per-user subscription cap is
min(max_subscriptions_per_user, max_sessions_per_user * subscription_max_per_session).
With defaults (10 sessions, 100 per session, 500 global), the cap is 500.
max_sessions_per_ip: usizeMaximum concurrent SSE sessions per source IP.
max_subscriptions_per_user: usizeCap on a user’s total subscriptions across every active session.
Global per-user cap across all sessions. With max_sessions_per_user=10
and subscription_max_per_session=100, the effective per-user cap is
min(500, 10*100) = 500. Lowering this below
max_sessions_per_user * subscription_max_per_session enforces a tighter
global ceiling regardless of how subscriptions are distributed.
max_cached_result_bytes: usizePer-query cached-result memory ceiling (bytes). Cached results exceeding this size are dropped after re-execution.
Trait Implementations§
Source§impl Clone for RealtimeConfig
impl Clone for RealtimeConfig
Source§fn clone(&self) -> RealtimeConfig
fn clone(&self) -> RealtimeConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RealtimeConfig
impl Debug for RealtimeConfig
Source§impl Default for RealtimeConfig
impl Default for RealtimeConfig
Source§impl<'de> Deserialize<'de> for RealtimeConfig
impl<'de> Deserialize<'de> for RealtimeConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for RealtimeConfig
impl RefUnwindSafe for RealtimeConfig
impl Send for RealtimeConfig
impl Sync for RealtimeConfig
impl Unpin for RealtimeConfig
impl UnsafeUnpin for RealtimeConfig
impl UnwindSafe for RealtimeConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more