pub struct WorkerPool { /* private fields */ }Expand description
Builder for a pool of server workers.
Implementations§
Source§impl WorkerPool
impl WorkerPool
Sourcepub fn name<T: AsRef<str>>(self, name: T) -> Self
pub fn name<T: AsRef<str>>(self, name: T) -> Self
Sets the worker thread name prefix.
The configured name is used for worker thread names.
Sourcepub fn workers(self, num: usize) -> Self
pub fn workers(self, num: usize) -> Self
Sets the number of worker threads to start.
By default, the server uses the number of available logical CPUs.
Sourcepub fn stop_runtime(self) -> Self
pub fn stop_runtime(self) -> Self
Stops the current ntex runtime when the server manager is dropped.
By default “stop runtime” is disabled.
Sourcepub fn stop_on_panic(self) -> Self
pub fn stop_on_panic(self) -> Self
Stops the server when one of the workers panics.
By default, “stop on panic” is disabled.
Sourcepub fn disable_signals(self) -> Self
pub fn disable_signals(self) -> Self
Disable signal handling.
By default, signal handling is enabled.
Sourcepub fn graceful_shutdown(self) -> Self
pub fn graceful_shutdown(self) -> Self
Graceful shutdown.
Gracefully shuts down on SIGSEGV or SIGQUIT and app panics. Graceful shutdown is always enabled for SIGTERM. By default, it is disabled for SIGSEGV and SIGQUIT and panics.
Sourcepub fn shutdown_timeout<T: Into<Millis>>(self, timeout: T) -> Self
pub fn shutdown_timeout<T: Into<Millis>>(self, timeout: T) -> Self
Timeout for graceful worker shutdown.
After receiving a stop signal, workers have this much time to finish serving requests. Workers that are still alive after the timeout are forcefully dropped.
By default, the shutdown timeout is set to 30 seconds.
Sourcepub fn enable_affinity(self) -> Self
pub fn enable_affinity(self) -> Self
Enables CPU affinity for worker threads.
By default, affinity is disabled.
Trait Implementations§
Source§impl Clone for WorkerPool
impl Clone for WorkerPool
Source§fn clone(&self) -> WorkerPool
fn clone(&self) -> WorkerPool
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more