diff --git a/Cargo.lock b/Cargo.lock index 9812ca093ff..e653393ac15 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3306,6 +3306,7 @@ dependencies = [ "lazy_static", "local-ip-address", "rand 0.8.5", + "rayon", "reqwest 0.12.24", "secp256k1", "serde", diff --git a/cmd/ethrex/Cargo.toml b/cmd/ethrex/Cargo.toml index 5092c49cc48..47b51f87129 100644 --- a/cmd/ethrex/Cargo.toml +++ b/cmd/ethrex/Cargo.toml @@ -43,6 +43,7 @@ serde_json.workspace = true tokio = { workspace = true, features = ["full"] } anyhow = "1.0.86" rand = "0.8.5" +rayon.workspace = true local-ip-address = "0.6" tokio-util.workspace = true lazy_static.workspace = true diff --git a/cmd/ethrex/ethrex.rs b/cmd/ethrex/ethrex.rs index aeeb16a20ea..15467714127 100644 --- a/cmd/ethrex/ethrex.rs +++ b/cmd/ethrex/ethrex.rs @@ -49,6 +49,11 @@ async fn server_shutdown( async fn main() -> eyre::Result<()> { let CLI { opts, command } = CLI::parse(); + rayon::ThreadPoolBuilder::default() + .thread_name(|i| format!("rayon-worker-{i}")) + .build_global() + .expect("failed to build rayon threadpool"); + if let Some(subcommand) = command { return subcommand.run(&opts).await; }