Switch offchain workers to new futures (#3285)

* Switch offchain workers to new futures

* Fix tests
This commit is contained in:
Pierre Krieger
2019-08-08 09:35:12 +02:00
committed by Gavin Wood
parent b29277239a
commit 3d65753d48
5 changed files with 13 additions and 16 deletions
+3 -3
View File
@@ -23,7 +23,7 @@ use std::{
};
use client::backend::OffchainStorage;
use futures::{Stream, Future, sync::mpsc};
use futures::{StreamExt as _, Future, future, channel::mpsc};
use log::{info, debug, warn, error};
use network::{PeerId, Multiaddr, NetworkStateInfo};
use codec::{Encode, Decode};
@@ -297,14 +297,14 @@ impl<A: ChainApi> AsyncApi<A> {
}
/// Run a processing task for the API
pub fn process(mut self) -> impl Future<Item=(), Error=()> {
pub fn process(mut self) -> impl Future<Output = ()> {
let receiver = self.receiver.take().expect("Take invoked only once.");
receiver.for_each(move |msg| {
match msg {
ExtMessage::SubmitExtrinsic(ext) => self.submit_extrinsic(ext),
}
Ok(())
future::ready(())
})
}