mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 10:31:04 +00:00
Expose that BasicQueue expects blocking spawn (#5860)
* Expose that `BasicQueue` expects blocking spawn Up to now `BasicQueue` expected a closure that to spawn a `Future`. This was expected to be a closure that spawns a blocking future. However, this wasn't documented anywhere. This pr introduces a new trait `SpawnBlocking` that exposes this requirement to the outside. * Feedback
This commit is contained in:
@@ -27,7 +27,7 @@ macro_rules! new_full_start {
|
||||
($config:expr) => {{
|
||||
use std::sync::Arc;
|
||||
use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;
|
||||
|
||||
|
||||
let mut import_setup = None;
|
||||
let inherent_data_providers = sp_inherents::InherentDataProviders::new();
|
||||
|
||||
@@ -45,15 +45,16 @@ macro_rules! new_full_start {
|
||||
let select_chain = select_chain.take()
|
||||
.ok_or_else(|| sc_service::Error::SelectChainRequired)?;
|
||||
|
||||
let (grandpa_block_import, grandpa_link) =
|
||||
sc_finality_grandpa::block_import(client.clone(), &(client.clone() as Arc<_>), select_chain)?;
|
||||
let (grandpa_block_import, grandpa_link) = sc_finality_grandpa::block_import(
|
||||
client.clone(),
|
||||
&(client.clone() as Arc<_>),
|
||||
select_chain,
|
||||
)?;
|
||||
|
||||
let aura_block_import = sc_consensus_aura::AuraBlockImport::<_, _, _, AuraPair>::new(
|
||||
grandpa_block_import.clone(), client.clone(),
|
||||
);
|
||||
|
||||
let spawner = |future| spawn_task_handle.spawn_blocking("import-queue-worker", future);
|
||||
|
||||
let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair, _>(
|
||||
sc_consensus_aura::slot_duration(&*client)?,
|
||||
aura_block_import,
|
||||
@@ -61,7 +62,7 @@ macro_rules! new_full_start {
|
||||
None,
|
||||
client,
|
||||
inherent_data_providers.clone(),
|
||||
spawner,
|
||||
spawn_task_handle,
|
||||
)?;
|
||||
|
||||
import_setup = Some((grandpa_block_import, grandpa_link));
|
||||
@@ -208,8 +209,6 @@ pub fn new_light(config: Configuration) -> Result<impl AbstractService, ServiceE
|
||||
let finality_proof_request_builder =
|
||||
finality_proof_import.create_finality_proof_request_builder();
|
||||
|
||||
let spawner = |future| spawn_task_handle.spawn_blocking("import-queue-worker", future);
|
||||
|
||||
let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair, _>(
|
||||
sc_consensus_aura::slot_duration(&*client)?,
|
||||
grandpa_block_import,
|
||||
@@ -217,7 +216,7 @@ pub fn new_light(config: Configuration) -> Result<impl AbstractService, ServiceE
|
||||
Some(Box::new(finality_proof_import)),
|
||||
client,
|
||||
inherent_data_providers.clone(),
|
||||
spawner,
|
||||
spawn_task_handle,
|
||||
)?;
|
||||
|
||||
Ok((import_queue, finality_proof_request_builder))
|
||||
|
||||
@@ -50,7 +50,11 @@ macro_rules! new_full_start {
|
||||
})?
|
||||
.with_transaction_pool(|config, client, _fetcher, prometheus_registry| {
|
||||
let pool_api = sc_transaction_pool::FullChainApi::new(client.clone());
|
||||
Ok(sc_transaction_pool::BasicPool::new(config, std::sync::Arc::new(pool_api), prometheus_registry))
|
||||
Ok(sc_transaction_pool::BasicPool::new(
|
||||
config,
|
||||
std::sync::Arc::new(pool_api),
|
||||
prometheus_registry,
|
||||
))
|
||||
})?
|
||||
.with_import_queue(|_config, client, mut select_chain, _transaction_pool, spawn_task_handle| {
|
||||
let select_chain = select_chain.take()
|
||||
@@ -68,8 +72,6 @@ macro_rules! new_full_start {
|
||||
client.clone(),
|
||||
)?;
|
||||
|
||||
let spawner = |future| spawn_task_handle.spawn_blocking("import-queue-worker", future);
|
||||
|
||||
let import_queue = sc_consensus_babe::import_queue(
|
||||
babe_link.clone(),
|
||||
block_import.clone(),
|
||||
@@ -77,7 +79,7 @@ macro_rules! new_full_start {
|
||||
None,
|
||||
client,
|
||||
inherent_data_providers.clone(),
|
||||
spawner,
|
||||
spawn_task_handle,
|
||||
)?;
|
||||
|
||||
import_setup = Some((block_import, grandpa_link, babe_link));
|
||||
@@ -308,8 +310,6 @@ pub fn new_light(config: Configuration)
|
||||
client.clone(),
|
||||
)?;
|
||||
|
||||
let spawner = |future| spawn_task_handle.spawn_blocking("import-queue-worker", future);
|
||||
|
||||
let import_queue = sc_consensus_babe::import_queue(
|
||||
babe_link,
|
||||
babe_block_import,
|
||||
@@ -317,7 +317,7 @@ pub fn new_light(config: Configuration)
|
||||
Some(Box::new(finality_proof_import)),
|
||||
client.clone(),
|
||||
inherent_data_providers.clone(),
|
||||
spawner,
|
||||
spawn_task_handle,
|
||||
)?;
|
||||
|
||||
Ok((import_queue, finality_proof_request_builder))
|
||||
|
||||
Reference in New Issue
Block a user