mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 13:57: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:
@@ -81,13 +81,18 @@ fn import_single_good_block_without_header_fails() {
|
||||
|
||||
#[test]
|
||||
fn async_import_queue_drops() {
|
||||
let executor = sp_core::testing::SpawnBlockingExecutor::new();
|
||||
// Perform this test multiple times since it exhibits non-deterministic behavior.
|
||||
for _ in 0..100 {
|
||||
let verifier = PassThroughVerifier(true);
|
||||
|
||||
let threads_pool = futures::executor::ThreadPool::new().unwrap();
|
||||
let spawner = |future| threads_pool.spawn_ok(future);
|
||||
let queue = BasicQueue::new(verifier, Box::new(substrate_test_runtime_client::new()), None, None, spawner);
|
||||
let queue = BasicQueue::new(
|
||||
verifier,
|
||||
Box::new(substrate_test_runtime_client::new()),
|
||||
None,
|
||||
None,
|
||||
&executor,
|
||||
);
|
||||
drop(queue);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user