-
Notifications
You must be signed in to change notification settings - Fork 289
ffi: make room and timeline creation orthogonal #4716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This gets rid of the `Timeline` stored in an FFI `Room`. There's no good reason why we should create and hold on to a live timeline instance when we have a `Room` instance, since we might want a `Room` to only perform `Room`-related operations. As a result, this gets rid of `Room::timeline`, which would return the cached timeline instance. `Room::timeline_with_configuration()` can be used to create a new timeline instance for a given room, or `RoomListItem::init_timeline()` and then `RoomListItem::timeline()`.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4716 +/- ##
=======================================
Coverage 85.97% 85.97%
=======================================
Files 290 290
Lines 34065 34065
=======================================
+ Hits 29288 29289 +1
+ Misses 4777 4776 -1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. FEWER! TIMELINE! FEWER! TIMELINE!
bindings/matrix-sdk-ffi/src/room.rs
Outdated
let timeline = SdkTimeline::builder(&self.inner) | ||
.track_read_marker_and_receipts() | ||
.build() | ||
.await |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a risk that the creation of the Timeline
and the installation of all its tasks, take a lot of time? Maybe we should add a big warning in the doc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We know it can be slow, if there are many events, especially because of read receipts, so yeah I'll add a comment 👍
Dropping this PR:
See dependencies in #4718. |
This gets rid of the
Timeline
stored in an FFIRoom
. There's no good reason why we should create and hold on to a live timeline instance when we have aRoom
instance, since we might want aRoom
to only performRoom
-related operations.In general, holding onto live timelines in scattered places may lead to having the auto-linked-chunk-shrink optimization not trigger, so we need to be careful and minimize the number of live timelines at all costs.
As a result, this gets rid of
Room::timeline
, which would return the cached timeline instance.Room::timeline_with_configuration()
can be used to create a new timeline instance for a given room, orRoomListItem::init_timeline()
and thenRoomListItem::timeline()
.Also renamed the FFI
Room::inner
(which is a… SDK Room) toRoom::sdk
. Is this too cute? 🥺cc @jmartinesp @stefanceriu, if you could test it out please :-)