mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-11 23:31:07 +00:00
rpc server: make possible to disable/enable batch requests (#3364)
The rationale behind this, is that it may be useful for some users actually disable RPC batch requests or limit them by length instead of the total size bytes of the batch. This PR adds two new CLI options: ``` --rpc-disable-batch-requests - disable batch requests on the server --rpc-max-batch-request-len <LEN> - limit batches to LEN on the server. ```
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
//! Service configuration.
|
||||
|
||||
pub use jsonrpsee::server::BatchRequestConfig as RpcBatchRequestConfig;
|
||||
use prometheus_endpoint::Registry;
|
||||
use sc_chain_spec::ChainSpec;
|
||||
pub use sc_client_db::{BlocksPruning, Database, DatabaseSource, PruningMode};
|
||||
@@ -103,6 +104,8 @@ pub struct Configuration {
|
||||
pub rpc_port: u16,
|
||||
/// The number of messages the JSON-RPC server is allowed to keep in memory.
|
||||
pub rpc_message_buffer_capacity: u32,
|
||||
/// JSON-RPC server batch config.
|
||||
pub rpc_batch_config: RpcBatchRequestConfig,
|
||||
/// RPC rate limit per minute.
|
||||
pub rpc_rate_limit: Option<NonZeroU32>,
|
||||
/// Prometheus endpoint configuration. `None` if disabled.
|
||||
|
||||
@@ -393,6 +393,7 @@ where
|
||||
|
||||
let server_config = sc_rpc_server::Config {
|
||||
addrs: [addr, backup_addr],
|
||||
batch_config: config.rpc_batch_config,
|
||||
max_connections: config.rpc_max_connections,
|
||||
max_payload_in_mb: config.rpc_max_request_size,
|
||||
max_payload_out_mb: config.rpc_max_response_size,
|
||||
|
||||
Reference in New Issue
Block a user