Skip to content
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

chore(sdk): Remove RoomEventCacheUpdate::Clear #4627

Merged
merged 2 commits into from
Feb 5, 2025

Conversation

Hywan
Copy link
Member

@Hywan Hywan commented Feb 5, 2025

This patch removes the Clear variant of the RoomEventCacheUpdate enum. This one is not needed anymore since we have UpdateTimelineEvents which contains updates as Vec<VectorDiff<_>>. VectorDiff has a Clear variant. It resulted in a double clear every time.

This patch updates RoomEventCacheInner::reset and RoomEventCacheInner::with_events_mut to annotate them with a #[must_use]. Since they return the updates as VectorDiffs, they must be broadcasted/propagated somewhere, likely with RoomEventCacheUpdate. This mechanism ensures to not miss updates.


Hywan added a commit to Hywan/matrix-rust-sdk that referenced this pull request Feb 5, 2025
Copy link

codecov bot commented Feb 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.69%. Comparing base (8a76587) to head (55b6c1a).
Report is 14 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4627      +/-   ##
==========================================
- Coverage   85.70%   85.69%   -0.02%     
==========================================
  Files         292      292              
  Lines       33406    33409       +3     
==========================================
- Hits        28632    28630       -2     
- Misses       4774     4779       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Hywan added a commit to Hywan/matrix-rust-sdk that referenced this pull request Feb 5, 2025
@Hywan Hywan force-pushed the fix-sdk-event-cache-clear branch from 9476b3f to e467f1e Compare February 5, 2025 10:55
Hywan added 2 commits February 5, 2025 12:07
This patch removes the `Clear` variant of the `RoomEventCacheUpdate`
enum. This one is not needed anymore since we have
`UpdateTimelineEvents` which contains updates as `Vec<VectorDiff<_>>`.
`VectorDiff` _has_ a `Clear` variant. It resulted in a double clear
every time.

This patch updates `RoomEventCacheInner::reset` and
`RoomEventCacheInner::with_events_mut` to annotate them with a
`#[must_use]`. Since they return the updates as `VectorDiff`s,
they **must** be broadcasted/propagated somewhere, likely with
`RoomEventCacheUpdate`. This mechanism ensures to not miss updates.
@Hywan Hywan force-pushed the fix-sdk-event-cache-clear branch from e467f1e to 55b6c1a Compare February 5, 2025 11:07
@Hywan Hywan marked this pull request as ready for review February 5, 2025 11:07
@Hywan Hywan requested a review from a team as a code owner February 5, 2025 11:07
@Hywan Hywan requested review from stefanceriu and removed request for a team February 5, 2025 11:07
Copy link
Member

@stefanceriu stefanceriu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me, looks good! 👍

@Hywan Hywan merged commit ed8c1d5 into matrix-org:main Feb 5, 2025
42 of 61 checks passed
toger5 pushed a commit to toger5/matrix-rust-sdk that referenced this pull request Feb 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants