fix: lazy computation in thread default

Co-authored-by: Martin Grigorov <martin-g@users.noreply.github.com>
This commit is contained in:
Nate Nethercott 2025-05-13 14:14:48 +02:00 committed by GitHub
parent e96c1d4b0f
commit 806e983aa5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -760,7 +760,7 @@ impl TryFrom<&IndexerOpts> for IndexerConfig {
fn try_from(other: &IndexerOpts) -> Result<Self, Self::Error> { fn try_from(other: &IndexerOpts) -> Result<Self, Self::Error> {
// use 1/2 cpu threads if no value specified // use 1/2 cpu threads if no value specified
let max_indexing_threads = other.max_indexing_threads.unwrap_or(num_cpus::get() / 2); let max_indexing_threads = other.max_indexing_threads.unwrap_or_else(|| num_cpus::get() / 2);
let thread_pool = ThreadPoolNoAbortBuilder::new() let thread_pool = ThreadPoolNoAbortBuilder::new()
.thread_name(|index| format!("indexing-thread:{index}")) .thread_name(|index| format!("indexing-thread:{index}"))