tako_rs_server_pt/
config.rs1use std::time::Duration;
2
3#[derive(Debug, Clone)]
5pub struct PerThreadConfig {
6 pub workers: usize,
8 pub pin_to_core: bool,
10 pub backlog: i32,
12 pub drain_timeout: Duration,
15}
16
17impl Default for PerThreadConfig {
18 fn default() -> Self {
19 Self {
20 workers: num_cpus(),
21 pin_to_core: cfg!(feature = "affinity"),
22 backlog: 1024,
23 drain_timeout: Duration::from_secs(30),
24 }
25 }
26}
27
28fn num_cpus() -> usize {
29 std::thread::available_parallelism().map_or(1, std::num::NonZero::get)
30}