Skip to content

Commit 8e9baef

Browse files
committed
Auto merge of #2529 - jtgeibel:fix-blocking-thread-count, r=JohnTitor
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. r? @JohnTitor
2 parents 11a77cd + e373e12 commit 8e9baef

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/bin/server.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ use conduit_hyper::Service;
1313
use futures_util::future::FutureExt;
1414
use reqwest::blocking::Client;
1515

16+
const CORE_THREADS: usize = 4;
17+
1618
#[allow(clippy::large_enum_variant)]
1719
enum Server {
1820
Civet(CivetServer),
@@ -66,8 +68,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
6668
let mut rt = tokio::runtime::Builder::new()
6769
.threaded_scheduler()
6870
.enable_all()
69-
.core_threads(4)
70-
.max_threads(threads as usize)
71+
.core_threads(CORE_THREADS)
72+
.max_threads(threads as usize + CORE_THREADS)
7173
.build()
7274
.unwrap();
7375

0 commit comments

Comments
 (0)