mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-18 02:31:03 +00:00
Use SpawnNamed instead of Spawn in Overseer (#1430)
* Use SpawnNamed instead of Spawn in Overseer * reexport SpawnNamed and fix doc tests * Fix deps
This commit is contained in:
@@ -10,3 +10,4 @@ futures = "0.3.5"
|
||||
async-trait = "0.1"
|
||||
polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem" }
|
||||
parking_lot = "0.10.0"
|
||||
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
@@ -21,9 +21,9 @@ use polkadot_subsystem::messages::AllMessages;
|
||||
|
||||
use futures::prelude::*;
|
||||
use futures::channel::mpsc;
|
||||
use futures::task::{Spawn, SpawnExt};
|
||||
use futures::poll;
|
||||
use parking_lot::Mutex;
|
||||
use sp_core::traits::SpawnNamed;
|
||||
|
||||
use std::convert::Infallible;
|
||||
use std::pin::Pin;
|
||||
@@ -155,7 +155,7 @@ pub struct TestSubsystemContext<M, S> {
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl<M: Send + 'static, S: Spawn + Send + 'static> SubsystemContext for TestSubsystemContext<M, S> {
|
||||
impl<M: Send + 'static, S: SpawnNamed + Send + 'static> SubsystemContext for TestSubsystemContext<M, S> {
|
||||
type Message = M;
|
||||
|
||||
async fn try_recv(&mut self) -> Result<Option<FromOverseer<M>>, ()> {
|
||||
@@ -170,8 +170,11 @@ impl<M: Send + 'static, S: Spawn + Send + 'static> SubsystemContext for TestSubs
|
||||
self.rx.next().await.ok_or(SubsystemError)
|
||||
}
|
||||
|
||||
async fn spawn(&mut self, s: Pin<Box<dyn Future<Output = ()> + Send>>) -> SubsystemResult<()> {
|
||||
self.spawn.spawn(s).map_err(Into::into)
|
||||
async fn spawn(&mut self, name: &'static str, s: Pin<Box<dyn Future<Output = ()> + Send>>)
|
||||
-> SubsystemResult<()>
|
||||
{
|
||||
self.spawn.spawn(name, s);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn send_message(&mut self, msg: AllMessages) -> SubsystemResult<()> {
|
||||
|
||||
Reference in New Issue
Block a user