mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 20:27:58 +00:00
Move spawning tasks from thread pools to Service's TaskManager for block importing (#5647)
Co-Authored-By: Pierre Krieger <pierre.krieger1708@gmail.com>
This commit is contained in:
@@ -41,7 +41,7 @@ macro_rules! new_full_start {
|
||||
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))
|
||||
})?
|
||||
.with_import_queue(|_config, client, mut select_chain, _transaction_pool| {
|
||||
.with_import_queue(|_config, client, mut select_chain, _transaction_pool, spawn_task_handle| {
|
||||
let select_chain = select_chain.take()
|
||||
.ok_or_else(|| sc_service::Error::SelectChainRequired)?;
|
||||
|
||||
@@ -52,13 +52,16 @@ macro_rules! new_full_start {
|
||||
grandpa_block_import.clone(), client.clone(),
|
||||
);
|
||||
|
||||
let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair>(
|
||||
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,
|
||||
Some(Box::new(grandpa_block_import.clone())),
|
||||
None,
|
||||
client,
|
||||
inherent_data_providers.clone(),
|
||||
spawner,
|
||||
)?;
|
||||
|
||||
import_setup = Some((grandpa_block_import, grandpa_link));
|
||||
@@ -191,7 +194,7 @@ pub fn new_light(config: Configuration) -> Result<impl AbstractService, ServiceE
|
||||
);
|
||||
Ok(pool)
|
||||
})?
|
||||
.with_import_queue_and_fprb(|_config, client, backend, fetcher, _select_chain, _tx_pool| {
|
||||
.with_import_queue_and_fprb(|_config, client, backend, fetcher, _select_chain, _tx_pool, spawn_task_handle| {
|
||||
let fetch_checker = fetcher
|
||||
.map(|fetcher| fetcher.checker().clone())
|
||||
.ok_or_else(|| "Trying to start light import queue without active fetch checker")?;
|
||||
@@ -205,13 +208,16 @@ pub fn new_light(config: Configuration) -> Result<impl AbstractService, ServiceE
|
||||
let finality_proof_request_builder =
|
||||
finality_proof_import.create_finality_proof_request_builder();
|
||||
|
||||
let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair>(
|
||||
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,
|
||||
None,
|
||||
Some(Box::new(finality_proof_import)),
|
||||
client,
|
||||
inherent_data_providers.clone(),
|
||||
spawner,
|
||||
)?;
|
||||
|
||||
Ok((import_queue, finality_proof_request_builder))
|
||||
|
||||
Reference in New Issue
Block a user