Fix indexeddb threadpool (#37649)

Resolves #37638. Fixes threadpool name and adds a config preference
(`threadpools_indexeddb_workers_max`).

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
This commit is contained in:
Ashwin Naren 2025-06-23 15:06:16 -07:00 committed by GitHub
parent 2879aa264d
commit 476b05676f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View file

@ -223,6 +223,8 @@ pub struct Preferences {
pub threadpools_fallback_worker_num: i64, pub threadpools_fallback_worker_num: i64,
/// Maximum number of workers for the Image Cache thread pool /// Maximum number of workers for the Image Cache thread pool
pub threadpools_image_cache_workers_max: i64, pub threadpools_image_cache_workers_max: i64,
/// Maximum number of workers for the IndexedDB thread pool
pub threadpools_indexeddb_workers_max: i64,
/// Maximum number of workers for the Networking async runtime thread pool /// Maximum number of workers for the Networking async runtime thread pool
pub threadpools_async_runtime_workers_max: i64, pub threadpools_async_runtime_workers_max: i64,
/// Maximum number of workers for the Core Resource Manager /// Maximum number of workers for the Core Resource Manager
@ -391,6 +393,7 @@ impl Preferences {
threadpools_async_runtime_workers_max: 6, threadpools_async_runtime_workers_max: 6,
threadpools_fallback_worker_num: 3, threadpools_fallback_worker_num: 3,
threadpools_image_cache_workers_max: 4, threadpools_image_cache_workers_max: 4,
threadpools_indexeddb_workers_max: 4,
threadpools_resource_workers_max: 4, threadpools_resource_workers_max: 4,
threadpools_webrender_workers_max: 4, threadpools_webrender_workers_max: 4,
webgl_testing_context_creation_error: false, webgl_testing_context_creation_error: false,

View file

@ -165,14 +165,14 @@ impl IndexedDBManager {
let thread_count = thread::available_parallelism() let thread_count = thread::available_parallelism()
.map(|i| i.get()) .map(|i| i.get())
.unwrap_or(pref!(threadpools_fallback_worker_num) as usize) .unwrap_or(pref!(threadpools_fallback_worker_num) as usize)
.min(pref!(threadpools_async_runtime_workers_max).max(1) as usize); .min(pref!(threadpools_indexeddb_workers_max).max(1) as usize);
IndexedDBManager { IndexedDBManager {
port, port,
idb_base_dir, idb_base_dir,
databases: HashMap::new(), databases: HashMap::new(),
thread_pool: Arc::new(CoreResourceThreadPool::new( thread_pool: Arc::new(CoreResourceThreadPool::new(
thread_count, thread_count,
"ImageCache".to_string(), "IndexedDB".to_string(),
)), )),
} }
} }