pub struct PoolConfig {
pub min_processes: usize,
pub max_processes: usize,
pub transport: MontyTransport,
pub checkout_timeout: Option<Duration>,
pub request_timeout: Option<Duration>,
pub feed_duration_limit_grace: Option<Duration>,
pub turn_duration_limit_grace: Option<Duration>,
pub max_checkouts_per_worker: Option<u32>,
pub auto_resume: bool,
}Expand description
Configuration for a Pool.
Fields§
§min_processes: usizeWorkers spawned eagerly at pool creation and kept warm. Forced to 0 for
the MontyTransport::Websocket transport (connections are made
per-checkout, not pre-warmed).
max_processes: usizeHard cap on live workers; checkouts beyond this wait.
transport: MontyTransportHow workers are reached (spawned locally or connected to remotely).
checkout_timeout: Option<Duration>How long Pool::checkout waits for a free worker before
PoolError::Exhausted. None waits forever.
request_timeout: Option<Duration>Parent-side hard deadline per protocol turn: when it expires the
worker is killed and the call fails with PoolError::Timeout. This
backstops the child-side ResourceLimits — it also catches a child
that hangs in ways the sandbox limits cannot see. Synchronous host
telemetry callbacks prevent the timer from being polled while they run.
feed_duration_limit_grace: Option<Duration>Grace period for the automatic ResourceLimits::max_feed_duration
backstop.
When a session has a feed budget, the worker reports the running feed’s execution time on every turn-ending event (the sandbox clock is the single source of truth: it runs only while the interpreter executes, never during suspensions waiting on the host or between feeds), and the parent bounds each turn by what that budget has left plus this grace.
The grace is the window in which the sandbox may raise TimeoutError
itself and keep the session alive; a worker that misses it is killed and
the call fails with PoolError::Timeout, so too short a grace costs
workers that would have recovered.
turn_duration_limit_grace: Option<Duration>feed_duration_limit_grace for the
ResourceLimits::max_turn_duration backstop: each turn is bounded by
that whole limit plus this, the turn clock starting at zero.
max_checkouts_per_worker: Option<u32>Recycle (kill and respawn) a worker after this many checkouts, to bound the impact of any slow leak in a long-lived child.
auto_resume: boolResume a session transparently when a relay that stores sessions answers
a request with Shutdown: the checkout redials, reloads the state the
shutdown named and re-sends the request the relay reported it did not run. The session’s suspension
and sleep totals carry over. WebSocket transport only; on by default.
Implementations§
Source§impl PoolConfig
impl PoolConfig
Sourcepub fn subprocess(binary_path: impl Into<PathBuf>) -> Self
pub fn subprocess(binary_path: impl Into<PathBuf>) -> Self
Creates a subprocess-transport config with defaults: min_processes = 1,
max_processes = available parallelism, no timeouts, a 1s grace on
each of the two duration backstops, no recycling.