remove unwrap from admin room build_and_append_pdu
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
1893b45de3
commit
38c2e5567e
2 changed files with 12 additions and 5 deletions
|
@ -107,11 +107,14 @@ impl Service {
|
||||||
pub fn start_handler(self: &Arc<Self>) {
|
pub fn start_handler(self: &Arc<Self>) {
|
||||||
let self2 = Arc::clone(self);
|
let self2 = Arc::clone(self);
|
||||||
tokio::spawn(async move {
|
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;
|
let mut receiver = self.receiver.lock().await;
|
||||||
// TODO: Use futures when we have long admin commands
|
// TODO: Use futures when we have long admin commands
|
||||||
//let mut futures = FuturesUnordered::new();
|
//let mut futures = FuturesUnordered::new();
|
||||||
|
@ -157,8 +160,7 @@ impl Service {
|
||||||
&conduit_user,
|
&conduit_user,
|
||||||
&conduit_room,
|
&conduit_room,
|
||||||
&state_lock)
|
&state_lock)
|
||||||
.await
|
.await?;
|
||||||
.unwrap(); // TODO: can we remove this unwrap?
|
|
||||||
|
|
||||||
|
|
||||||
drop(state_lock);
|
drop(state_lock);
|
||||||
|
@ -166,6 +168,8 @@ impl Service {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn process_message(&self, room_message: String, event_id: Arc<EventId>) {
|
pub fn process_message(&self, room_message: String, event_id: Arc<EventId>) {
|
||||||
|
|
|
@ -112,7 +112,10 @@ impl Service {
|
||||||
pub fn start_handler(self: &Arc<Self>) {
|
pub fn start_handler(self: &Arc<Self>) {
|
||||||
let self2 = Arc::clone(self);
|
let self2 = Arc::clone(self);
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
self2.handler().await.unwrap();
|
self2
|
||||||
|
.handler()
|
||||||
|
.await
|
||||||
|
.expect("Failed to initialize request sending handler");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue