diff --git a/.env.example b/.env.example index 4079f52ed..f4b956c0e 100644 --- a/.env.example +++ b/.env.example @@ -18,6 +18,7 @@ DEPLOYER_ACCOUNT_PRIVATE_KEY=0x0288a51c164874bb6a1ca7bd1cb71823c234a86d0f7b150d7 # Kakarot Environment KAKAROT_RPC_URL=127.0.0.1:3030 +RPC_MAX_CONNECTIONS=100 ## check `./deployments/katana/deployments.json` after running `make devnet` KAKAROT_ADDRESS= PROXY_ACCOUNT_CLASS_HASH=0x105356ebf9c56df723dc6952dae0cffd8f6e0c22281cf0ee7df8ddde60281c0 diff --git a/src/eth_rpc/mod.rs b/src/eth_rpc/mod.rs index d4f97854f..6d721cd74 100644 --- a/src/eth_rpc/mod.rs +++ b/src/eth_rpc/mod.rs @@ -36,7 +36,11 @@ pub async fn run_server( let service = ServiceBuilder::new().layer(cors); - let server = ServerBuilder::default().set_middleware(service).build(socket_addr.parse::()?).await?; + let server = ServerBuilder::default() + .max_connections(std::env::var("RPC_MAX_CONNECTIONS").unwrap_or("100".to_string()).parse().unwrap()) + .set_middleware(service) + .build(socket_addr.parse::()?) + .await?; let addr = server.local_addr()?;