Skip to content

Commit

Permalink
feat: Adds custom max concurrent request on jsonrpsee http client
Browse files Browse the repository at this point in the history
  • Loading branch information
moraesjeremias committed May 23, 2024
1 parent a749655 commit c871ecb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -585,14 +585,21 @@ async fn main() {
)
.init();

let max_concurrent_request: usize = env::var("MAX_CONCURRENT_REQUEST")
.ok()
.and_then(|max_request| max_request.parse::<usize>().ok())
.unwrap_or(256);

let shared_state = Arc::new(AppState {
avail_client: HttpClientBuilder::default()
.max_concurrent_requests(max_concurrent_request)
.build(
env::var("AVAIL_CLIENT_URL")
.unwrap_or("https://avail-turing.public.blastapi.io/api".to_owned()),
)
.unwrap(),
ethereum_client: HttpClientBuilder::default()
.max_concurrent_requests(max_concurrent_request)
.build(
env::var("ETHEREUM_CLIENT_URL")
.unwrap_or("https://ethereum-sepolia.publicnode.com".to_owned()),
Expand Down

0 comments on commit c871ecb

Please sign in to comment.