mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 12:17:58 +00:00
Update the service to std futures (#4447)
* Switch service to futures03 * Fix tests * Fix service test and cli * Re-add Executor trait to SpawnTaskHandle * Fix node-service * Update babe * Fix browser node * Update aura * Revert back to tokio-executor to fix runtime panic * Add todo item * Fix service tests again * Timeout test futures * Fix tests * nits * Fix service test * Remove zstd patch * Re-add futures01 to aura and babe tests as a dev-dep * Change failing test to tee * Fix node * Upgrade tokio * fix society * Start switching grandpa to stable futures * Revert "Start switching grandpa to stable futures" This reverts commit 9c1976346237637effc07c13f7d0403daf5e71cf. * Fix utils * Revert substrate service test * Revert gitlab Co-authored-by: thiolliere <gui.thiolliere@gmail.com>
This commit is contained in:
@@ -22,10 +22,7 @@ use service::{
|
||||
ChainSpec, RuntimeGenesis
|
||||
};
|
||||
use wasm_bindgen::prelude::*;
|
||||
use futures::{
|
||||
TryFutureExt as _, FutureExt as _, Stream as _, Future as _, TryStreamExt as _,
|
||||
channel::{oneshot, mpsc}, future::{poll_fn, ok}, compat::*,
|
||||
};
|
||||
use futures::{prelude::*, channel::{oneshot, mpsc}, future::{poll_fn, ok}, compat::*};
|
||||
use std::task::Poll;
|
||||
use std::pin::Pin;
|
||||
use chain_spec::Extension;
|
||||
@@ -82,8 +79,7 @@ struct RpcMessage {
|
||||
}
|
||||
|
||||
/// Create a Client object that connects to a service.
|
||||
pub fn start_client(service: impl AbstractService) -> Client {
|
||||
let mut service = service.compat();
|
||||
pub fn start_client(mut service: impl AbstractService) -> Client {
|
||||
// We dispatch a background task responsible for processing the service.
|
||||
//
|
||||
// The main action performed by the code below consists in polling the service with
|
||||
@@ -94,10 +90,8 @@ pub fn start_client(service: impl AbstractService) -> Client {
|
||||
loop {
|
||||
match Pin::new(&mut rpc_send_rx).poll_next(cx) {
|
||||
Poll::Ready(Some(message)) => {
|
||||
let fut = service.get_ref()
|
||||
let fut = service
|
||||
.rpc_query(&message.session, &message.rpc_json)
|
||||
.compat()
|
||||
.unwrap_or_else(|_| None)
|
||||
.boxed();
|
||||
let _ = message.send_back.send(fut);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user