Clean up and add comment
This commit is contained in:
parent
5cf9094bb9
commit
8d4ab1bab1
|
@ -358,10 +358,16 @@ impl JsonRpcService {
|
||||||
|
|
||||||
let ledger_path = ledger_path.to_path_buf();
|
let ledger_path = ledger_path.to_path_buf();
|
||||||
|
|
||||||
let runtime01 = {
|
// sadly, some parts of our current rpc implemention block the jsonrpc's
|
||||||
use tokio_01::runtime::{Builder as RuntimeBuilder, Runtime, TaskExecutor};
|
// _socket-listening_ event loop for too long, due to (blocking) long IO or intesive CPU,
|
||||||
RuntimeBuilder::new()
|
// causing no further processing of incoming requests and ultimatily innocent clients timing-out.
|
||||||
.name_prefix("rpc")
|
// So create a (shared) multi-threaded event_loop for jsonrpc and set its .threads() to 1,
|
||||||
|
// so that we avoid the single-threaded event loops from being created automatically by
|
||||||
|
// jsonrpc for threads when .threads(N > 1) is given.
|
||||||
|
let event_loop = {
|
||||||
|
tokio_01::runtime::Builder::new()
|
||||||
|
.core_threads(rpc_threads)
|
||||||
|
.name_prefix("sol-rpc-el")
|
||||||
.build()
|
.build()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
};
|
};
|
||||||
|
@ -384,7 +390,7 @@ impl JsonRpcService {
|
||||||
io,
|
io,
|
||||||
move |_req: &hyper::Request<hyper::Body>| request_processor.clone(),
|
move |_req: &hyper::Request<hyper::Body>| request_processor.clone(),
|
||||||
)
|
)
|
||||||
.event_loop_executor(runtime01.executor())
|
.event_loop_executor(event_loop.executor())
|
||||||
.threads(1)
|
.threads(1)
|
||||||
.cors(DomainsValidation::AllowOnly(vec![
|
.cors(DomainsValidation::AllowOnly(vec![
|
||||||
AccessControlAllowOrigin::Any,
|
AccessControlAllowOrigin::Any,
|
||||||
|
|
Loading…
Reference in New Issue