remove unwrap from admin room build_and_append_pdu

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-03-27 17:08:30 -04:00 committed by June
parent 1893b45de3
commit 38c2e5567e
2 changed files with 12 additions and 5 deletions

View file

@ -107,11 +107,14 @@ impl Service {
pub fn start_handler(self: &Arc<Self>) {
let self2 = Arc::clone(self);
tokio::spawn(async move {
self2.handler().await;
self2
.handler()
.await
.expect("Failed to initialize admin room handler");
});
}
async fn handler(&self) {
async fn handler(&self) -> Result<()> {
let mut receiver = self.receiver.lock().await;
// TODO: Use futures when we have long admin commands
//let mut futures = FuturesUnordered::new();
@ -157,8 +160,7 @@ impl Service {
&conduit_user,
&conduit_room,
&state_lock)
.await
.unwrap(); // TODO: can we remove this unwrap?
.await?;
drop(state_lock);
@ -166,6 +168,8 @@ impl Service {
}
}
}
Ok(())
}
pub fn process_message(&self, room_message: String, event_id: Arc<EventId>) {

View file

@ -112,7 +112,10 @@ impl Service {
pub fn start_handler(self: &Arc<Self>) {
let self2 = Arc::clone(self);
tokio::spawn(async move {
self2.handler().await.unwrap();
self2
.handler()
.await
.expect("Failed to initialize request sending handler");
});
}