File tree Expand file tree Collapse file tree 3 files changed +14
-4
lines changed
matrix-sdk-base/src/event_cache/store Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -173,8 +173,14 @@ pub fn load_pinned_events_benchmark(c: &mut Criterion) {
173
173
assert_eq ! ( pinned_event_ids. len( ) , PINNED_EVENTS_COUNT ) ;
174
174
175
175
// Reset cache so it always loads the events from the mocked endpoint
176
- // TODO: allow clearing the events table?
177
- //client.event_cache().empty_immutable_cache().await;
176
+ client
177
+ . event_cache_store ( )
178
+ . lock ( )
179
+ . await
180
+ . unwrap ( )
181
+ . clear_all_rooms_chunks ( )
182
+ . await
183
+ . unwrap ( ) ;
178
184
179
185
let timeline = Timeline :: builder ( & room)
180
186
. with_focus ( TimelineFocus :: PinnedEvents {
Original file line number Diff line number Diff line change @@ -98,7 +98,9 @@ pub trait EventCacheStore: AsyncTraitDeps {
98
98
/// Clear persisted events for all the rooms.
99
99
///
100
100
/// This will empty and remove all the linked chunks stored previously,
101
- /// using the above [`Self::handle_linked_chunk_updates`] methods.
101
+ /// using the above [`Self::handle_linked_chunk_updates`] methods. It
102
+ /// must *also* delete all the events' content, if they were stored in a
103
+ /// separate table.
102
104
async fn clear_all_rooms_chunks ( & self ) -> Result < ( ) , Self :: Error > ;
103
105
104
106
/// Given a set of event IDs, return the duplicated events along with their
Original file line number Diff line number Diff line change @@ -863,7 +863,9 @@ impl EventCacheStore for SqliteEventCacheStore {
863
863
. await ?
864
864
. with_transaction ( move |txn| {
865
865
// Remove all the chunks, and let cascading do its job.
866
- txn. execute ( "DELETE FROM linked_chunks" , ( ) )
866
+ txn. execute ( "DELETE FROM linked_chunks" , ( ) ) ?;
867
+ // Also clear all the events' contents.
868
+ txn. execute ( "DELETE FROM events" , ( ) )
867
869
} )
868
870
. await ?;
869
871
Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments