From 5b975a23f82ed2a3aa88142a044a2a90b1207e0f Mon Sep 17 00:00:00 2001 From: p11 Date: Wed, 16 Apr 2025 22:00:54 +0200 Subject: [PATCH] Allow thread pool size configuration --- src/main.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 502b7f6..87336c1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -62,7 +62,11 @@ fn start_server( eprintln!("Strated server!"); let context: Arc> = Arc::default(); - let mut pool = ThreadPool::new(4); + + let thread_pool_size = std::env::var("THREAD_POOL") + .map(|s| s.parse().unwrap_or(4)) + .unwrap_or(4); + let mut pool = ThreadPool::new(thread_pool_size); for stream in listener.incoming() { eprintln!("New connection!");