-
Notifications
You must be signed in to change notification settings - Fork 270
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
fix(timeline): maintain aggregations when an event is deduplicated #4576
base: main
Are you sure you want to change the base?
Conversation
6c2393e
to
140ab9a
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4576 +/- ##
==========================================
- Coverage 85.73% 85.71% -0.03%
==========================================
Files 292 292
Lines 33492 33549 +57
==========================================
+ Hits 28715 28756 +41
- Misses 4777 4793 +16 ☔ View full report in Codecov by Sentry. |
e660de4
to
78d32b5
Compare
095a5ed
to
3d7feaa
Compare
… the event has been redacted
forever = the lifetime of a timeline.
…regation_redaction`
…eItemContent::reactions()` I give up; returning a reference would be better to avoid plain cloning, but there's no way to make a Lazy reference work on wasm, because the map transitively uses a field that's not sync/send :( Which is sad, because the default value would be an empty map, and not contain any data that wouldn't be sync/send anyways.
3d7feaa
to
c54dbfe
Compare
c54dbfe
to
da828c3
Compare
A live review party sounds good to me, and I've asked some other members of the Rust team whether they'd like to join because I'm not sure I should look at this on my own. |
Some context
An aggregation is an event that relates to another event: for instance, a
reaction, a poll response, and so on and so forth.
Some requirements
Because of the sync mechanisms and federation, it can happen that a related
event is received before receiving the event it relates to. Those events
must be accounted for, stashed somewhere, and reapplied later, if/when the
related-to event shows up.
In addition to that, a room's event cache can also decide to move events
around, in its own internal representation (likely because it ran into some
duplicate events, or it managed to decrypt a previously UTD event).
When that happens, a timeline opened on the given room
will see a removal then re-insertion of the given event. If that event was
the target of aggregations, then those aggregations must be re-applied when
the given event is reinserted.
Some solution
To satisfy both requirements, the [
Aggregations
] "manager" object providedby this PR will take care of memoizing aggregations, for the entire
lifetime of the timeline (or until it's clear'd by some
caller). Aggregations are saved in memory, and have the same lifetime as
that of a timeline. This makes it possible to apply pending aggregations
to cater for the first use case, and to never lose any aggregations in the
second use case.
Some points for the reviewer