mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 17:01:09 +00:00
rpc-http-threads cli arg (#8890)
* Add optional `rpc-http-threads` cli arg * Update `http::ServerBuilder`threads
This commit is contained in:
@@ -33,6 +33,9 @@ pub const MAX_PAYLOAD: usize = 15 * 1024 * 1024;
|
||||
/// Default maximum number of connections for WS RPC servers.
|
||||
const WS_MAX_CONNECTIONS: usize = 100;
|
||||
|
||||
/// Default thread pool size for RPC HTTP servers.
|
||||
const HTTP_THREADS: usize = 4;
|
||||
|
||||
/// The RPC IoHandler containing all requested APIs.
|
||||
pub type RpcHandler<T> = pubsub::PubSubHandler<T, RpcMiddleware>;
|
||||
|
||||
@@ -79,11 +82,12 @@ mod inner {
|
||||
/// **Note**: Only available if `not(target_os = "unknown")`.
|
||||
pub fn start_http<M: pubsub::PubSubMetadata + Default>(
|
||||
addr: &std::net::SocketAddr,
|
||||
thread_pool_size: Option<usize>,
|
||||
cors: Option<&Vec<String>>,
|
||||
io: RpcHandler<M>,
|
||||
) -> io::Result<http::Server> {
|
||||
http::ServerBuilder::new(io)
|
||||
.threads(4)
|
||||
.threads(thread_pool_size.unwrap_or(HTTP_THREADS))
|
||||
.health_api(("/health", "system_health"))
|
||||
.allowed_hosts(hosts_filtering(cors.is_some()))
|
||||
.rest_api(if cors.is_some() {
|
||||
|
||||
Reference in New Issue
Block a user