Skip to content

Commit

Permalink
refactor(event cache): make use of Chunk::num_items when deciding w…
Browse files Browse the repository at this point in the history
…hether to drop a previous empty event chunk
  • Loading branch information
bnjbvr committed Mar 3, 2025
1 parent 9bc0d8b commit def4be5
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions crates/matrix-sdk/src/event_cache/room/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ use eyeball::SharedObservable;
use eyeball_im::VectorDiff;
use matrix_sdk_base::{
deserialized_responses::{AmbiguityChange, TimelineEvent},
linked_chunk::ChunkContent,
sync::{JoinedRoomUpdate, LeftRoomUpdate, Timeline},
};
use ruma::{
Expand Down Expand Up @@ -560,12 +559,8 @@ impl RoomEventCacheInner {
// one, as it's not useful to keep it before a gap.
let prev_chunk_to_remove =
room_events.rchunks().next().and_then(|chunk| {
match chunk.content() {
ChunkContent::Items(events) if events.is_empty() => {
Some(chunk.identifier())
}
_ => None,
}
(chunk.is_items() && chunk.num_items() == 0)
.then_some(chunk.identifier())
});

room_events.push_gap(Gap { prev_token: prev_token.clone() });
Expand Down

0 comments on commit def4be5

Please sign in to comment.