Rebox future segmentations.

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk
2025-07-08 11:48:45 +00:00
parent aac49b09c7
commit 18f8d6c65c
14 changed files with 43 additions and 32 deletions

View File

@@ -7,7 +7,7 @@ use std::{
time::Instant,
};
use futures::{FutureExt, Stream, StreamExt, TryFutureExt, TryStreamExt};
use futures::{FutureExt, Stream, StreamExt, TryFutureExt, TryStreamExt, pin_mut};
use ruma::{EventId, OwnedEventId, RoomId};
use tuwunel_core::{
Err, Result, at, debug, debug_error, implement, trace,
@@ -80,13 +80,13 @@ where
const BUCKET: Bucket<'_> = BTreeSet::new();
let started = Instant::now();
let mut starting_ids = self
let starting_ids = self
.services
.short
.multi_get_or_create_shorteventid(starting_events.clone())
.zip(starting_events.clone().stream())
.boxed();
.zip(starting_events.clone().stream());
pin_mut!(starting_ids);
let mut buckets = [BUCKET; NUM_BUCKETS];
while let Some((short, starting_event)) = starting_ids.next().await {
let bucket: usize = short.try_into()?;

View File

@@ -112,6 +112,7 @@ pub async fn handle_incoming_pdu<'a>(
let (incoming_pdu, val) = self
.handle_outlier_pdu(origin, create_event, event_id, room_id, value, false)
.boxed()
.await?;
// 8. if not timeline event: stop

View File

@@ -61,6 +61,7 @@ where
.await?
} else {
self.state_at_incoming_resolved(&incoming_pdu, room_id, &room_version_id)
.boxed()
.await?
};
@@ -215,6 +216,7 @@ where
let new_room_state = self
.resolve_state(room_id, &room_version_id, state_after)
.boxed()
.await?;
// Set the new room state to the resolved state

View File

@@ -118,14 +118,11 @@ pub async fn backfill_if_required(&self, room_id: &RoomId, from: PduCount) -> Re
},
)
.await;
match response {
| Ok(response) => {
for pdu in response.pdus {
if let Err(e) = self
.backfill_pdu(backfill_server, pdu)
.boxed()
.await
{
if let Err(e) = self.backfill_pdu(backfill_server, pdu).await {
debug_warn!("Failed to add backfilled pdu in room {room_id}: {e}");
}
}