pub(crate) fn start_sync_process(
        runtime: &Runtime,
        sync: Arc<RwLock<HashSet<Url>>>,
        nodes: HashSet<Url>,
        node_sync_interval: Duration,
        mut kill: Receiver<()>,
    ) {
        let node_sync_interval = TokioDuration::from_nanos(node_sync_interval.as_nanos().try_into().unwrap());

        runtime.enter(|| {
            tokio::spawn(async move {
                loop {
                    tokio::select! {
                        _ = async {
                                // delay first since the first `sync_nodes` call is made by the builder
                                // to ensure the node list is filled before the client is used
                                delay_for(node_sync_interval).await;
                                Client::sync_nodes(&sync, &nodes).await;
                        } => {}
                        _ = kill.recv() => {}
                    }
                }
            });
        });
    }
/// Sync the node lists per node_sync_interval milliseconds
Sync the node lists per node_sync_interval milliseconds
Sync the node lists per node_sync_interval milliseconds
pub(crate) fn start_sync_process(
        runtime: &Runtime,
        sync: Arc<RwLock<HashSet<Url>>>,
        nodes: HashSet<Url>,
        node_sync_interval: Duration,
        mut kill: Receiver<()>,
    ) {
        let node_sync_interval = TokioDuration::from_nanos(node_sync_interval.as_nanos().try_into().unwrap());
        runtime.enter(|| {
            tokio::spawn(async move {
                loop {
                    tokio::select! {
                        _ = async {
                                // delay first since the first `sync_nodes` call is made by the builder
                                // to ensure the node list is filled before the client is used
                                delay_for(node_sync_interval).await;
                                Client::sync_nodes(&sync, &nodes).await;
                        } => {}
                        _ = kill.recv() => {}
                    }
                }
            });
        });
    }
pub ( crate ) fn start_sync_process ( runtime : & Runtime , sync : Arc < RwLock < HashSet < Url > > > , nodes : HashSet < Url > , node_sync_interval : Duration , mut kill : Receiver < ( ) > , ) { let node_sync_interval = TokioDuration :: from_nanos ( node_sync_interval . as_nanos ( ) . try_into ( ) . unwrap ( ) ) ; runtime . enter ( | | { tokio :: spawn ( async move { loop { tokio :: select ! { async { // delay first since the first `sync_nodes` call is made by the builder // to ensure the node list is filled before the client is used delay_for ( node_sync_interval ) await Client sync_nodes ( sync nodes ) await } { } kill recv ( ) { } } } } ) ; } ) ; }
Sync the node lists per node_sync_interval milliseconds
Sync the node lists per node_sync_interval milliseconds
runtime
&Runtime
sync
Arc<RwLock<HashSet<Url>>>
nodes
HashSet<Url>
node_sync_interval
Duration
kill
Receiver<()>
runtime
&Runtime
sync
Arc<RwLock<HashSet<Url>>>
nodes
HashSet<Url>
node_sync_interval
Duration
kill
Receiver<()>