1
0
Fork 0
mirror of https://forgejo.ellis.link/continuwuation/continuwuity.git synced 2025-07-30 11:48:31 +00:00

replace num_cpus dependency with available_parallelism()

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-05-25 20:58:37 +00:00 committed by June 🍓🦴
parent d2aef071bc
commit a537462d51
8 changed files with 22 additions and 13 deletions

View file

@ -108,7 +108,8 @@ impl KeyValueDatabaseEngine for Arc<Engine> {
clippy::cast_precision_loss,
clippy::cast_sign_loss
)]
let cache_size_per_thread = ((config.db_cache_capacity_mb * 1024.0) / ((num_cpus::get() as f64 * 2.0) + 1.0)) as u32;
let cache_size_per_thread = ((config.db_cache_capacity_mb * 1024.0)
/ ((conduit::utils::available_parallelism() as f64 * 2.0) + 1.0)) as u32;
let writer = Mutex::new(Engine::prepare_conn(&path, cache_size_per_thread)?);