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

Commit

Permalink
Make sure errors get logged (#6451)
Browse files Browse the repository at this point in the history
instead of silently dropped.

Co-authored-by: eskimor <[email protected]>
  • Loading branch information
eskimor and eskimor authored Dec 16, 2022
1 parent 6e3f2c5 commit eea7770
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
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

0 comments on commit eea7770

Please sign in to comment.