Skip to content

Commit

Permalink
export http max connections
Browse files Browse the repository at this point in the history
  • Loading branch information
Kayryu committed Feb 5, 2024
1 parent 0b46680 commit ba71273
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions client/rpc-servers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ pub async fn start_http<M: Send + Sync + 'static>(
cors: Option<&Vec<String>>,
max_payload_in_mb: Option<usize>,
max_payload_out_mb: Option<usize>,
max_connections: Option<usize>,
metrics: Option<RpcMetrics>,
rpc_api: RpcModule<M>,
rt: tokio::runtime::Handle,
Expand All @@ -99,10 +100,12 @@ pub async fn start_http<M: Send + Sync + 'static>(
.layer(ProxyGetRequestLayer::new("/health", "system_health")?)
.layer(try_into_cors(cors)?);

let max_conns = max_connections.unwrap_or(WS_MAX_CONNECTIONS) as u32;
let builder = ServerBuilder::new()
.max_request_body_size(max_payload_in)
.max_response_body_size(max_payload_out)
.set_host_filtering(host_filter)
.max_connections(max_conns)
.set_middleware(middleware)
.custom_tokio_runtime(rt)
.http_only();
Expand Down
1 change: 1 addition & 0 deletions client/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ where
config.rpc_cors.as_ref(),
max_request_size,
http_max_response_size,
config.rpc_ws_max_connections,
metrics.clone(),
gen_rpc_module(deny_unsafe(http_addr, &config.rpc_methods))?,
config.tokio_handle.clone(),
Expand Down

0 comments on commit ba71273

Please sign in to comment.