From e373e1213bd28651b2ad118f17d7e442494ff480 Mon Sep 17 00:00:00 2001 From: Justin Geibel Date: Mon, 25 May 2020 20:26:26 -0400 Subject: [PATCH] Account for core_threads when setting up background threads The number of core_threads counts against the max_threads setting. For parity with the thread count enforced by `civet`, the core thread count is added to `SERVER_THREADS` when setting the max thread count. --- src/bin/server.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/bin/server.rs b/src/bin/server.rs index 64ffa732a1c..2ab8de00f0a 100644 --- a/src/bin/server.rs +++ b/src/bin/server.rs @@ -13,6 +13,8 @@ use conduit_hyper::Service; use futures_util::future::FutureExt; use reqwest::blocking::Client; +const CORE_THREADS: usize = 4; + #[allow(clippy::large_enum_variant)] enum Server { Civet(CivetServer), @@ -66,8 +68,8 @@ fn main() -> Result<(), Box> { let mut rt = tokio::runtime::Builder::new() .threaded_scheduler() .enable_all() - .core_threads(4) - .max_threads(threads as usize) + .core_threads(CORE_THREADS) + .max_threads(threads as usize + CORE_THREADS) .build() .unwrap();