Skip to content

Commit

Permalink
setup test thread pool
Browse files Browse the repository at this point in the history
  • Loading branch information
fgimenez committed Feb 19, 2025
1 parent 2930979 commit 37244eb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions crates/engine/tree/src/tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3358,11 +3358,16 @@ mod tests {

struct MockStateRootTaskFactory {
roots: Vec<B256>,
thread_pool: Arc<rayon::ThreadPool>,
}

impl MockStateRootTaskFactory {
fn new() -> Self {
Self { roots: Vec::new() }
let num_threads = root::rayon_thread_pool_size();
let thread_pool =
Arc::new(rayon::ThreadPoolBuilder::new().num_threads(num_threads).build().unwrap());

Self { roots: Vec::new(), thread_pool }
}

fn add_state_root(&mut self, root: B256) {
Expand All @@ -3378,7 +3383,7 @@ mod tests {
}

fn thread_pool(&self) -> Arc<rayon::ThreadPool> {
Arc::new(rayon::ThreadPoolBuilder::new().build().unwrap())
self.thread_pool.clone()
}
}

Expand Down

0 comments on commit 37244eb

Please sign in to comment.