From 373c3fc0cbc9851b2926c6282adee57b97606077 Mon Sep 17 00:00:00 2001 From: apoorvsadana <95699312+apoorvsadana@users.noreply.github.com> Date: Tue, 23 Jan 2024 17:34:54 +0530 Subject: [PATCH] Rpc max connection env (#720) * rpc_max_connections env * remove .idea --- .env.example | 1 + src/eth_rpc/mod.rs | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) 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()?;