Broken: I can't seem to return either an impl Future or Result to satisfy for_each

This commit is contained in:
Deirdre Connolly 2019-10-21 04:51:37 -04:00 committed by Deirdre Connolly
parent 3548998980
commit e65f5a05ea
1 changed files with 11 additions and 4 deletions

View File

@ -4,12 +4,13 @@ use std::{
pin::Pin,
sync::{Arc, Mutex},
task::{Context, Poll},
time::Duration,
};
use chrono::Utc;
use futures::channel::mpsc;
use tokio::{codec::Framed, net::TcpStream, prelude::*};
use tower::Service;
use tokio::{codec::Framed, net::TcpStream, prelude::*, timer::Interval};
use tower::{Service, ServiceExt};
use tracing::{span, Level};
use tracing_futures::Instrument;
@ -18,8 +19,7 @@ use zebra_chain::types::BlockHeight;
use crate::{
constants,
protocol::{codec::*, internal::*, message::*, types::*},
timestamp_collector::TimestampCollector,
types::{MetaAddr, Network},
types::MetaAddr,
BoxedStdError, Config,
};
@ -208,6 +208,13 @@ where
.boxed(),
);
// client.ready().await?;
tokio::spawn(
Interval::new_interval(Duration::from_secs(60))
.for_each(|_| client.call(Request::Ping(Nonce::default()))),
);
Ok(client)
};
fut.instrument(connector_span).boxed()