Skip to content

Commit

Permalink
remove default batch request size limit
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyukang committed Jul 19, 2024
1 parent 9fff036 commit a0fac83
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions rpc/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ use tokio_util::codec::{FramedRead, FramedWrite, LinesCodec, LinesCodecError};
use tower_http::cors::CorsLayer;
use tower_http::timeout::TimeoutLayer;

const DEFAULT_BATCH_LIMIT: usize = 2000;

static JSONRPC_BATCH_LIMIT: once_cell::sync::OnceCell<usize> = once_cell::sync::OnceCell::new();

#[doc(hidden)]
Expand All @@ -51,8 +49,9 @@ impl RpcServer {
/// * `io_handler` - RPC methods handler. See [ServiceBuilder](../service_builder/struct.ServiceBuilder.html).
/// * `handler` - Tokio runtime handle.
pub fn new(config: RpcConfig, io_handler: IoHandler, handler: Handle) -> Self {
let _ = JSONRPC_BATCH_LIMIT
.get_or_init(|| config.rpc_batch_limit.unwrap_or(DEFAULT_BATCH_LIMIT));
if let Some(jsonrpc_batch_limit) = config.rpc_batch_limit {
let _ = JSONRPC_BATCH_LIMIT.get_or_init(|| jsonrpc_batch_limit);
}

let rpc = Arc::new(io_handler);

Expand Down
2 changes: 1 addition & 1 deletion test/template/ckb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ enable_deprecated_rpc = true
# threads number for RPC service, default value is the number of CPU cores
# threads = 4

# the largest rpc batch request size, default is 2000
# the largest rpc batch request size, default is disabled
# rpc_batch_limit = 2000

[tx_pool]
Expand Down

0 comments on commit a0fac83

Please sign in to comment.