Optimize backfill_if_required conditions.

Optimize backfill_pdu.

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk
2025-08-29 04:46:11 +00:00
parent 54ce221e88
commit 12bdfe3b66
3 changed files with 89 additions and 79 deletions

View File

@@ -8,6 +8,7 @@ use tuwunel_core::{
debug::INFO_SPAN_LEVEL,
err, implement,
matrix::{Event, room_version},
trace,
utils::stream::IterStream,
warn,
};
@@ -59,6 +60,7 @@ pub async fn handle_incoming_pdu<'a>(
) -> Result<Option<RawPduId>> {
// 1. Skip the PDU if we already have it as a timeline event
if let Ok(pdu_id) = self.services.timeline.get_pdu_id(event_id).await {
trace!(?event_id, "exists");
return Ok(Some(pdu_id));
}