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

refactor(event cache): simplify the locking situation #4115

Merged
merged 4 commits into from
Oct 15, 2024

Conversation

bnjbvr
Copy link
Member

@bnjbvr bnjbvr commented Oct 10, 2024

This simplifies the locking situation, in particular it would've made the bug fixed by #3501 impossible to happen in the first place (or at least, way more obvious).

Fixes #3502. Thanks @Hywan for the technical discussion we had about it.

…ood todo list

All the items have their equivalent sub item in the issue anyways.
…ble state

This limits the possibility of race conditions in users of this API.
…ture

It only contained two fields, and it avoids one extra level of cognitive
overhead and makes the type hierarchy flatter.
@bnjbvr bnjbvr requested a review from Hywan October 10, 2024 15:20
@bnjbvr bnjbvr requested a review from a team as a code owner October 10, 2024 15:20
Copy link

codecov bot commented Oct 10, 2024

Codecov Report

Attention: Patch coverage is 97.14286% with 2 lines in your changes missing coverage. Please review.

Project coverage is 84.69%. Comparing base (3291940) to head (8c2579b).
Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
crates/matrix-sdk/src/event_cache/pagination.rs 90.47% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4115      +/-   ##
==========================================
+ Coverage   84.67%   84.69%   +0.02%     
==========================================
  Files         269      269              
  Lines       28816    28822       +6     
==========================================
+ Hits        24401    24412      +11     
+ Misses       4415     4410       -5     

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

None => PaginationToken::HitEnd,
};
{
let mut tokens = self.tokens.lock().unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

I have a deja-vu, didn't I suggest a single lock for this a month or two ago? Anyways, nice that we remove some locks.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that rings a bell, sorry I hadn't listened more 😅

@bnjbvr bnjbvr merged commit 6dd2e3b into main Oct 15, 2024
41 checks passed
@bnjbvr bnjbvr deleted the bnjbvr/event-cache-locking branch October 15, 2024 14:15
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.

event cache: rethink locking of internal room data
2 participants