mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 02:37:58 +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:
@@ -606,15 +606,12 @@ pub trait TestNetFactory: Sized {
|
||||
);
|
||||
let verifier = VerifierAdapter::new(Arc::new(Mutex::new(Box::new(verifier) as Box<_>)));
|
||||
|
||||
let threads_pool = futures::executor::ThreadPool::new().unwrap();
|
||||
let spawner = |future| threads_pool.spawn_ok(future);
|
||||
|
||||
let import_queue = Box::new(BasicQueue::new(
|
||||
verifier.clone(),
|
||||
Box::new(block_import.clone()),
|
||||
justification_import,
|
||||
finality_proof_import,
|
||||
spawner,
|
||||
&sp_core::testing::SpawnBlockingExecutor::new(),
|
||||
));
|
||||
|
||||
let listen_addr = build_multiaddr![Memory(rand::random::<u64>())];
|
||||
@@ -687,15 +684,12 @@ pub trait TestNetFactory: Sized {
|
||||
);
|
||||
let verifier = VerifierAdapter::new(Arc::new(Mutex::new(Box::new(verifier) as Box<_>)));
|
||||
|
||||
let threads_pool = futures::executor::ThreadPool::new().unwrap();
|
||||
let spawner = |future| threads_pool.spawn_ok(future);
|
||||
|
||||
let import_queue = Box::new(BasicQueue::new(
|
||||
verifier.clone(),
|
||||
Box::new(block_import.clone()),
|
||||
justification_import,
|
||||
finality_proof_import,
|
||||
spawner,
|
||||
&sp_core::testing::SpawnBlockingExecutor::new(),
|
||||
));
|
||||
|
||||
let listen_addr = build_multiaddr![Memory(rand::random::<u64>())];
|
||||
|
||||
Reference in New Issue
Block a user