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

Commit

Permalink
Ensure candidate-backing and provisioner exit on missing Overseer (#6939
Browse files Browse the repository at this point in the history
)

This ensures that both subsystems exit when the Overseer has exited
because of some error.
  • Loading branch information
bkchr authored Mar 23, 2023
1 parent 616b287 commit bee5c7e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions node/core/backing/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ pub enum Error {

#[error(transparent)]
SubsystemError(#[from] SubsystemError),

#[fatal]
#[error(transparent)]
OverseerExited(SubsystemError),
}

/// Utility for eating top level errors and log them.
Expand Down
3 changes: 2 additions & 1 deletion node/core/backing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ async fn run_iteration<Context>(
}
}
from_overseer = ctx.recv().fuse() => {
match from_overseer? {
// Map the error to ensure that the subsystem exits when the overseer is gone.
match from_overseer.map_err(Error::OverseerExited)? {
FromOrchestra::Signal(OverseerSignal::ActiveLeaves(update)) => handle_active_leaves_update(
&mut *ctx,
update,
Expand Down
4 changes: 4 additions & 0 deletions node/core/provisioner/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ pub enum Error {

#[error(transparent)]
SubsystemError(#[from] SubsystemError),

#[fatal]
#[error(transparent)]
OverseerExited(SubsystemError),
}

/// Used by `get_onchain_disputes` to represent errors related to fetching on-chain disputes from the Runtime
Expand Down
3 changes: 2 additions & 1 deletion node/core/provisioner/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ async fn run_iteration<Context>(
loop {
futures::select! {
from_overseer = ctx.recv().fuse() => {
match from_overseer? {
// Map the error to ensure that the subsystem exits when the overseer is gone.
match from_overseer.map_err(Error::OverseerExited)? {
FromOrchestra::Signal(OverseerSignal::ActiveLeaves(update)) =>
handle_active_leaves_update(update, per_relay_parent, inherent_delays),
FromOrchestra::Signal(OverseerSignal::BlockFinalized(..)) => {},
Expand Down

0 comments on commit bee5c7e

Please sign in to comment.