Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Make sure errors get logged #6451

Merged
merged 1 commit into from
Dec 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion node/overseer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,15 @@ where
}

/// Run the `Overseer`.
pub async fn run(mut self) -> SubsystemResult<()> {
///
/// Logging any errors.
pub async fn run(self) {
if let Err(err) = self.run_inner().await {
gum::error!(target: LOG_TARGET, ?err, "Overseer exited with error");
}
}

async fn run_inner(mut self) -> SubsystemResult<()> {
let metrics = self.metrics.clone();
spawn_metronome_metrics(&mut self, metrics)?;

Expand Down
14 changes: 7 additions & 7 deletions node/overseer/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ fn overseer_metrics_work() {
.unwrap();

let mut handle = Handle::new(handle);
let overseer_fut = overseer.run().fuse();
let overseer_fut = overseer.run_inner().fuse();

pin_mut!(overseer_fut);

Expand Down Expand Up @@ -302,7 +302,7 @@ fn overseer_ends_on_subsystem_exit() {
.build()
.unwrap();

overseer.run().await.unwrap();
overseer.run_inner().await.unwrap();
})
}

Expand Down Expand Up @@ -400,7 +400,7 @@ fn overseer_start_stop_works() {
.unwrap();
let mut handle = Handle::new(handle);

let overseer_fut = overseer.run().fuse();
let overseer_fut = overseer.run_inner().fuse();
pin_mut!(overseer_fut);

let mut ss5_results = Vec::new();
Expand Down Expand Up @@ -499,7 +499,7 @@ fn overseer_finalize_works() {
.unwrap();
let mut handle = Handle::new(handle);

let overseer_fut = overseer.run().fuse();
let overseer_fut = overseer.run_inner().fuse();
pin_mut!(overseer_fut);

let mut ss5_results = Vec::new();
Expand Down Expand Up @@ -595,7 +595,7 @@ fn overseer_finalize_leaf_preserves_it() {
.unwrap();
let mut handle = Handle::new(handle);

let overseer_fut = overseer.run().fuse();
let overseer_fut = overseer.run_inner().fuse();
pin_mut!(overseer_fut);

let mut ss5_results = Vec::new();
Expand Down Expand Up @@ -684,7 +684,7 @@ fn do_not_send_empty_leaves_update_on_block_finalization() {

let mut handle = Handle::new(handle);

let overseer_fut = overseer.run().fuse();
let overseer_fut = overseer.run_inner().fuse();
pin_mut!(overseer_fut);

let mut ss5_results = Vec::new();
Expand Down Expand Up @@ -947,7 +947,7 @@ fn overseer_all_subsystems_receive_signals_and_messages() {
.unwrap();

let mut handle = Handle::new(handle);
let overseer_fut = overseer.run().fuse();
let overseer_fut = overseer.run_inner().fuse();

pin_mut!(overseer_fut);

Expand Down
4 changes: 2 additions & 2 deletions node/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1112,8 +1112,8 @@ where
pin_mut!(forward);

select! {
_ = forward => (),
_ = overseer_fut => (),
() = forward => (),
() = overseer_fut => (),
complete => (),
}
}),
Expand Down