make sure to not create more thumbnail workers than available CPU cores

This commit is contained in:
Frederic Laing 2025-11-17 17:07:35 +01:00
parent bf7b9c192c
commit 4df14044aa
No known key found for this signature in database
GPG key ID: C126157F0CDCD306

View file

@ -105,7 +105,7 @@ const THUMBNAIL_SIZE: u32 = (ICON_SIZE_GRID as u32) * (ICON_SCALE_MAX as u32);
// Thumbnail generation semaphore - limits parallel thumbnail workers
// Uses 4 workers for balanced throughput and memory usage
pub static THUMB_SEMAPHORE: LazyLock<tokio::sync::Semaphore> =
LazyLock::new(|| tokio::sync::Semaphore::const_new(4));
LazyLock::new(|| tokio::sync::Semaphore::const_new(num_cpus::get().min(4)));
pub(crate) static SORT_OPTION_FALLBACK: LazyLock<FxHashMap<String, (HeadingOptions, bool)>> =
LazyLock::new(|| {