never allow only 1 tokio worker or rocksdb parallelism thread (max compare)

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-04-26 16:55:37 -04:00 committed by June
parent d172a6883d
commit 9f245281b1
2 changed files with 2 additions and 2 deletions

View File

@ -22,7 +22,7 @@ pub(crate) fn db_options(config: &Config, env: &mut Env, row_cache: &Cache, col_
// Processing
let threads = if config.rocksdb_parallelism_threads == 0 {
num_cpus::get() // max cores if user specified 0
std::cmp::max(2, num_cpus::get()) // max cores if user specified 0
} else {
config.rocksdb_parallelism_threads
};

View File

@ -515,7 +515,7 @@ fn init(args: clap::Args) -> Result<Server, Error> {
.enable_io()
.enable_time()
.thread_name("conduwuit:worker")
.worker_threads(num_cpus::get())
.worker_threads(std::cmp::max(2, num_cpus::get()))
.build()
.unwrap(),