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