mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 13:27:57 +00:00
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:
@@ -191,15 +191,14 @@ impl<M: Send + 'static, S: SpawnNamed + Send + 'static> SubsystemContext
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn send_message(&mut self, msg: AllMessages) -> SubsystemResult<()> {
|
||||
async fn send_message(&mut self, msg: AllMessages) {
|
||||
self.tx
|
||||
.send(msg)
|
||||
.await
|
||||
.expect("test overseer no longer live");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn send_messages<T>(&mut self, msgs: T) -> SubsystemResult<()>
|
||||
async fn send_messages<T>(&mut self, msgs: T)
|
||||
where
|
||||
T: IntoIterator<Item = AllMessages> + Send,
|
||||
T::IntoIter: Send,
|
||||
@@ -209,8 +208,6 @@ impl<M: Send + 'static, S: SpawnNamed + Send + 'static> SubsystemContext
|
||||
.send_all(&mut iter)
|
||||
.await
|
||||
.expect("test overseer no longer live");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -341,7 +338,7 @@ mod tests {
|
||||
|
||||
spawner.spawn("overseer", overseer.run().then(|_| async { () }).boxed());
|
||||
|
||||
block_on(handler.send_msg(CandidateSelectionMessage::Invalid(Default::default(), Default::default()))).unwrap();
|
||||
block_on(handler.send_msg(CandidateSelectionMessage::Invalid(Default::default(), Default::default())));
|
||||
assert!(matches!(block_on(rx.into_future()).0.unwrap(), CandidateSelectionMessage::Invalid(_, _)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user