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(crypto): Make memory store behave more like other stores #4558

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

BillCarsonFr
Copy link
Member

Attempt to make the memory store behave more like other stores.
This is following reports of Playwright flaky tests that are showing some panics of the memory store (used by the bots not the tested app).

The idea is to make the memory store works more like other stores by removing unwrap()s, serializing/deserialising structures instead of keep them around to be mutated by everyone. Add a global save_changes lock

PRO

Will behave more like other stores (might help and make the tests less flaky)

CONS

Might be slower

Breakdown

Best reviewed commit per commit (will squash at the end):

  • Replace unwrap with expect 17fa2c7

  • Serialize account and cache static account data b7ac36f

  • Serialize/Deserialise olm sessions 7c87d13

  • Ser/Deser inbound group sessions 9262c30

  • Add a global save change lock similar to other stores 70c2baf

  • Public API changes documented in changelogs (optional)

Signed-off-by:

@BillCarsonFr BillCarsonFr requested review from a team as code owners January 20, 2025 16:19
@BillCarsonFr BillCarsonFr requested review from Hywan and andybalaam and removed request for a team January 20, 2025 16:19
@andybalaam andybalaam changed the title refact(mem_tore): Make memory store behave more like other stores refact(mem_store): Make memory store behave more like other stores Jan 20, 2025
@andybalaam
Copy link
Member

Why squash at the end?

@bnjbvr bnjbvr changed the title refact(mem_store): Make memory store behave more like other stores refact(crypto): Make memory store behave more like other stores Jan 21, 2025
@bnjbvr bnjbvr changed the title refact(crypto): Make memory store behave more like other stores refactor(crypto): Make memory store behave more like other stores Jan 21, 2025
Copy link

codecov bot commented Jan 21, 2025

Codecov Report

Attention: Patch coverage is 98.61111% with 1 line in your changes missing coverage. Please review.

Project coverage is 85.42%. Comparing base (4c4dd03) to head (27ebbff).

Files with missing lines Patch % Lines
crates/matrix-sdk-crypto/src/store/memorystore.rs 98.61% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4558   +/-   ##
=======================================
  Coverage   85.42%   85.42%           
=======================================
  Files         286      286           
  Lines       32213    32247   +34     
=======================================
+ Hits        27517    27548   +31     
- Misses       4696     4699    +3     

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

Copy link
Member

@andybalaam andybalaam left a comment

Choose a reason for hiding this comment

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

This looks sensible to me.

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.

3 participants