Skip to content

Commit

Permalink
ffi: get rid of Room::poll_history as it's slow and likely unused
Browse files Browse the repository at this point in the history
It's super slow (as it recreates and backpaginates from the start again) and unused in both EX apps, which are our main FFI embedders.
  • Loading branch information
bnjbvr committed Jan 30, 2024
1 parent 3a543f1 commit fd26cbc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 29 deletions.
4 changes: 0 additions & 4 deletions bindings/matrix-sdk-ffi/src/room.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,6 @@ impl Room {
}
}

pub async fn poll_history(&self) -> Result<Arc<Timeline>, ClientError> {
Ok(Timeline::new(self.inner.poll_history().await?))
}

pub fn display_name(&self) -> Result<String, ClientError> {
let r = self.inner.clone();
RUNTIME.block_on(async move { Ok(r.display_name().await?.to_string()) })
Expand Down
28 changes: 3 additions & 25 deletions crates/matrix-sdk-ui/src/timeline/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,13 @@ use matrix_sdk::Room;
#[cfg(feature = "e2e-encryption")]
use matrix_sdk::{deserialized_responses::TimelineEvent, Result};
use matrix_sdk_base::latest_event::LatestEvent;
#[cfg(feature = "e2e-encryption")]
use ruma::{events::AnySyncTimelineEvent, serde::Raw};
use ruma::{
events::{
receipt::{Receipt, ReceiptThread, ReceiptType},
AnySyncMessageLikeEvent,
},
events::receipt::{Receipt, ReceiptThread, ReceiptType},
push::{PushConditionRoomCtx, Ruleset},
EventId, OwnedEventId, OwnedUserId, RoomVersionId, UserId,
};
#[cfg(feature = "e2e-encryption")]
use ruma::{events::AnySyncTimelineEvent, serde::Raw};
use tracing::{debug, error, warn};

use super::{Profile, TimelineBuilder};
Expand All @@ -53,9 +50,6 @@ pub trait RoomExt {
/// This allows to customize settings of the [`Timeline`] before
/// constructing it.
fn timeline_builder(&self) -> TimelineBuilder;

/// Get a [`Timeline`] for this room, filtered to only include poll events.
async fn poll_history(&self) -> crate::event_graph::Result<Timeline>;
}

#[async_trait]
Expand All @@ -67,22 +61,6 @@ impl RoomExt for Room {
fn timeline_builder(&self) -> TimelineBuilder {
Timeline::builder(self).track_read_marker_and_receipts()
}

async fn poll_history(&self) -> crate::event_graph::Result<Timeline> {
self.timeline_builder()
.event_filter(|e, _| {
matches!(
e,
AnySyncTimelineEvent::MessageLike(
AnySyncMessageLikeEvent::UnstablePollStart(_)
| AnySyncMessageLikeEvent::UnstablePollResponse(_)
| AnySyncMessageLikeEvent::UnstablePollEnd(_)
)
)
})
.build()
.await
}
}

#[async_trait]
Expand Down

0 comments on commit fd26cbc

Please sign in to comment.