mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-23 05:01:08 +00:00
Use tokio runtime handle instead of TaskExecutor abstraction (#9737)
* Use tokio runtime handle instead of TaskExecutor abstraction Before this pr we had the `TaskExecutor` abstraction which theoretically allowed that any futures executor could have been used. However, this was never tested and is currently not really required. Anyone running a node currently only used tokio and nothing else (because this was hard coded in CLI). So, this pr removes the `TaskExecutor` abstraction and relies directly on the tokio runtime handle. Besides this changes, this pr also makes sure that the http and ws rpc server use the same tokio runtime. This fixes a panic that occurred when you drop the rpc servers inside an async function (tokio doesn't like that a tokio runtime is dropped in the async context of another tokio runtime). As we don't use any custom runtime in the http rpc server anymore, this pr also removes the `rpc-http-threads` cli argument. If external parties complain that there aren't enough threads for the rpc server, we could bring support for increasing the thread count of the tokio runtime. * FMT * Fix try runtime * Fix integration tests and some other optimizations * Remove warnings
This commit is contained in:
@@ -35,8 +35,8 @@ pub use config::*;
|
||||
pub use error::*;
|
||||
pub use params::*;
|
||||
pub use runner::*;
|
||||
use sc_service::Configuration;
|
||||
pub use sc_service::{ChainSpec, Role};
|
||||
use sc_service::{Configuration, TaskExecutor};
|
||||
pub use sc_tracing::logging::LoggerBuilder;
|
||||
pub use sp_version::RuntimeVersion;
|
||||
use std::io::Write;
|
||||
@@ -216,9 +216,9 @@ pub trait SubstrateCli: Sized {
|
||||
fn create_configuration<T: CliConfiguration<DVC>, DVC: DefaultConfigurationValues>(
|
||||
&self,
|
||||
command: &T,
|
||||
task_executor: TaskExecutor,
|
||||
tokio_handle: tokio::runtime::Handle,
|
||||
) -> error::Result<Configuration> {
|
||||
command.create_configuration(self, task_executor)
|
||||
command.create_configuration(self, tokio_handle)
|
||||
}
|
||||
|
||||
/// Create a runner for the command provided in argument. This will create a Configuration and
|
||||
|
||||
Reference in New Issue
Block a user