Skip to content

Commit

Permalink
set number of threads to cpu count
Browse files Browse the repository at this point in the history
  • Loading branch information
Larkooo committed Sep 17, 2024
1 parent f60ef4f commit 5ffe50e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bin/torii/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ async fn main() -> anyhow::Result<()> {
sqlx::query("PRAGMA journal_mode = WAL;").execute(&pool).await?;
sqlx::query("PRAGMA synchronous = NORMAL;").execute(&pool).await?;

// Set the number of threads based on CPU count
let cpu_count = std::thread::available_parallelism().unwrap().get();
sqlx::query(&format!("PRAGMA threads = {};", cpu_count)).execute(&pool).await?;

sqlx::migrate!("../../crates/torii/migrations").run(&pool).await?;

let provider: Arc<_> = JsonRpcClient::new(HttpTransport::new(args.rpc)).into();
Expand Down

0 comments on commit 5ffe50e

Please sign in to comment.