pub struct WorkerConfig {
pub max_event_latency: Duration,
pub max_instances: usize,
pub max_cmds_per_iter: usize,
pub max_events_per_iter: usize,
}Expand description
Configuration for the shared FFI worker thread.
Applies only on the first init or init_with_config call. All subsequent calls reuse
the already running worker thread and ignore this parameter entirely.
Fields§
§max_event_latency: DurationMaximum permissible event latency. Controls how long the worker thread may sleep between polling cycles when all chats are idle. The sleep interval grows linearly from zero up to this value as idle time accumulates. Sending any command resets the interval immediately by waking the thread. Default: 1sec
max_instances: usizeMaximum number of chat instances the worker thread will serve simultaneously. init
returns CallError::Failure when this limit is reached. Passing 0 is valid but
prevents any chat from ever being created. Default: 20
max_cmds_per_iter: usizeMaximum number of commands executed per chat instance per scheduling iteration. Higher values improve throughput under command bursts at the cost of increased latency for other chat instances. Default: 3
max_events_per_iter: usizeMaximum number of events drained per chat instance per scheduling iteration. Higher values reduce event latency under event bursts at the cost of increased command latency for other chat instances. Default 6
Implementations§
Source§impl WorkerConfig
impl WorkerConfig
pub fn new() -> Self
pub fn with_event_latency(self, duration: Duration) -> Self
pub fn max_instances(self, max_instances: usize) -> Self
pub fn max_cmds_per_iter(self, max_cmds: usize) -> Self
pub fn max_events_per_iter(self, max_events: usize) -> Self
Trait Implementations§
Source§impl Clone for WorkerConfig
impl Clone for WorkerConfig
Source§fn clone(&self) -> WorkerConfig
fn clone(&self) -> WorkerConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more