Change SpawnedSubsystem type to log subsystem errors (#1878)

* Change SpawnedSubsystem type to log subsystem errors

* Remove clone
This commit is contained in:
Fedor Sakharov
2020-10-28 22:57:06 +03:00
committed by GitHub
parent 8a305ac963
commit 935fcd1666
16 changed files with 42 additions and 27 deletions
@@ -823,7 +823,6 @@ where
let future = self
.run(ctx)
.map_err(|e| SubsystemError::with_origin("availability-distribution", e))
.map(|_| ())
.boxed();
SpawnedSubsystem {
@@ -585,7 +585,7 @@ where
.map_err(|e| {
SubsystemError::with_origin("bitfield-distribution", e)
})
.map(|_| ()).boxed();
.boxed();
SpawnedSubsystem {
name: "bitfield-distribution-subsystem",
-1
View File
@@ -231,7 +231,6 @@ impl<Net, AD, Context> Subsystem<Context> for NetworkBridge<Net, AD>
.map_err(|e| {
SubsystemError::with_origin("network-bridge", e)
})
.map(|_| ())
.boxed();
SpawnedSubsystem {
name: "network-bridge-subsystem",
@@ -20,7 +20,7 @@
#![deny(missing_docs, unused_crate_dependencies)]
use std::time::Duration;
use futures::{channel::oneshot, FutureExt};
use futures::{channel::oneshot, FutureExt, TryFutureExt};
use log::trace;
use thiserror::Error;
@@ -122,9 +122,14 @@ where
Context: SubsystemContext<Message = CollatorProtocolMessage> + Sync + Send,
{
fn start(self, ctx: Context) -> SpawnedSubsystem {
let future = self
.run(ctx)
.map_err(|e| SubsystemError::with_origin("collator-protocol", e))
.boxed();
SpawnedSubsystem {
name: "collator-protocol-subsystem",
future: self.run(ctx).map(|_| ()).boxed(),
future,
}
}
}
@@ -66,7 +66,6 @@ impl<C> Subsystem<C> for PoVDistribution
// within `run`.
let future = self.run(ctx)
.map_err(|e| SubsystemError::with_origin("pov-distribution", e))
.map(|_| ())
.boxed();
SpawnedSubsystem {
name: "pov-distribution-subsystem",
@@ -616,4 +615,4 @@ impl metrics::Metrics for Metrics {
}
#[cfg(test)]
mod tests;
mod tests;
@@ -81,7 +81,7 @@ impl<C> Subsystem<C> for StatementDistribution
// within `run`.
SpawnedSubsystem {
name: "statement-distribution-subsystem",
future: self.run(ctx).map(|_| ()).boxed(),
future: self.run(ctx).boxed(),
}
}
}