reduce unnecessary clone in pdu handler
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
b8260e0104
commit
dd6621a720
1 changed files with 11 additions and 12 deletions
|
@ -118,15 +118,12 @@ async fn handle_pdus(
|
||||||
.lock(&room_id)
|
.lock(&room_id)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
resolved_map.insert(
|
let result = services
|
||||||
event_id.clone(),
|
.rooms
|
||||||
services
|
.event_handler
|
||||||
.rooms
|
.handle_incoming_pdu(origin, &room_id, &event_id, value, true)
|
||||||
.event_handler
|
.await
|
||||||
.handle_incoming_pdu(origin, &room_id, &event_id, value, true)
|
.map(|_| ());
|
||||||
.await
|
|
||||||
.map(|_| ()),
|
|
||||||
);
|
|
||||||
|
|
||||||
drop(mutex_lock);
|
drop(mutex_lock);
|
||||||
debug!(
|
debug!(
|
||||||
|
@ -134,12 +131,14 @@ async fn handle_pdus(
|
||||||
txn_elapsed = ?txn_start_time.elapsed(),
|
txn_elapsed = ?txn_start_time.elapsed(),
|
||||||
"Finished PDU {event_id}",
|
"Finished PDU {event_id}",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
resolved_map.insert(event_id, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
for pdu in &resolved_map {
|
for (id, result) in &resolved_map {
|
||||||
if let Err(e) = pdu.1 {
|
if let Err(e) = result {
|
||||||
if matches!(e, Error::BadRequest(ErrorKind::NotFound, _)) {
|
if matches!(e, Error::BadRequest(ErrorKind::NotFound, _)) {
|
||||||
warn!("Incoming PDU failed {pdu:?}");
|
warn!("Incoming PDU failed {id}: {e:?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue