mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 16:51:03 +00:00
Use async/await in build_network_future (#6533)
* Use async/await in build_network_future * Address concerns * Fix test
This commit is contained in:
@@ -29,7 +29,6 @@ use sp_runtime::traits::{Block as BlockT, Header};
|
||||
use sp_transaction_pool::TransactionPool;
|
||||
use sp_utils::{status_sinks, mpsc::tracing_unbounded};
|
||||
use std::{fmt::Display, sync::Arc, time::Duration, collections::VecDeque};
|
||||
use parking_lot::Mutex;
|
||||
|
||||
mod display;
|
||||
|
||||
@@ -82,7 +81,7 @@ impl<T: TransactionPool + MallocSizeOf> TransactionPoolAndMaybeMallogSizeOf for
|
||||
/// Builds the informant and returns a `Future` that drives the informant.
|
||||
pub fn build<B: BlockT, C>(
|
||||
client: Arc<C>,
|
||||
network_status_sinks: Arc<Mutex<status_sinks::StatusSinks<(NetworkStatus<B>, NetworkState)>>>,
|
||||
network_status_sinks: Arc<status_sinks::StatusSinks<(NetworkStatus<B>, NetworkState)>>,
|
||||
pool: Arc<impl TransactionPoolAndMaybeMallogSizeOf>,
|
||||
format: OutputFormat,
|
||||
) -> impl futures::Future<Output = ()>
|
||||
@@ -94,7 +93,7 @@ where
|
||||
|
||||
let client_1 = client.clone();
|
||||
let (network_status_sink, network_status_stream) = tracing_unbounded("mpsc_network_status");
|
||||
network_status_sinks.lock().push(Duration::from_millis(5000), network_status_sink);
|
||||
network_status_sinks.push(Duration::from_millis(5000), network_status_sink);
|
||||
|
||||
let display_notifications = network_status_stream
|
||||
.for_each(move |(net_status, _)| {
|
||||
|
||||
Reference in New Issue
Block a user