overseer: send_msg should not return an error (#1995)

* send_message should not return an error

* Apply suggestions from code review

Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>

* s/send_logging_error/send_and_log_error

Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>
This commit is contained in:
Andronik Ordian
2020-11-23 12:42:14 +01:00
committed by GitHub
parent 8cdb063f72
commit 69b103b1d5
21 changed files with 330 additions and 462 deletions
+7 -13
View File
@@ -207,13 +207,11 @@ where
{
let (tx, rx) = oneshot::channel();
ctx
.send_message(
AllMessages::RuntimeApi(RuntimeApiMessage::Request(parent, request_builder(tx)))
.try_into()
.map_err(|err| Error::SenderConversion(format!("{:?}", err)))?,
)
.await?;
ctx.send_message(
AllMessages::RuntimeApi(RuntimeApiMessage::Request(parent, request_builder(tx)))
.try_into()
.map_err(|err| Error::SenderConversion(format!("{:?}", err)))?,
).await;
Ok(rx)
}
@@ -752,7 +750,7 @@ where
break
},
outgoing = jobs.next().fuse() =>
Self::handle_outgoing(outgoing, &mut ctx, &mut err_tx).await,
Self::handle_outgoing(outgoing, &mut ctx).await,
complete => break,
}
}
@@ -866,13 +864,9 @@ where
async fn handle_outgoing(
outgoing: Option<Job::FromJob>,
ctx: &mut Context,
err_tx: &mut Option<mpsc::Sender<(Option<Hash>, JobsError<Job::Error>)>>,
) {
let msg = outgoing.expect("the Jobs stream never ends; qed");
if let Err(e) = ctx.send_message(msg.into()).await {
let e = JobsError::Utility(e.into());
Self::fwd_err(None, e, err_tx).await;
}
ctx.send_message(msg.into()).await;
}
}
@@ -63,7 +63,7 @@ pub async fn connect_to_validators<Context: SubsystemContext>(
relay_parent,
RuntimeApiRequest::ValidatorDiscovery(validators.clone(), tx),
)
)).await?;
)).await;
let maybe_authorities = rx.await??;
let authorities: Vec<_> = maybe_authorities.iter()
@@ -97,7 +97,7 @@ async fn connect_to_authorities<Context: SubsystemContext>(
validator_ids,
connected,
}
)).await?;
)).await;
Ok(connected_rx)
}