Skip to content

Conversation

@razvp
Copy link

@razvp razvp commented Nov 10, 2025

Fixes #5610

  • Public API changes documented in changelogs (optional)

Signed-off-by: Razvan [email protected]

@razvp razvp requested a review from a team as a code owner November 10, 2025 17:50
@razvp razvp requested review from Hywan and removed request for a team November 10, 2025 17:50
@razvp razvp force-pushed the thread-subs-bulk-upsert branch from 2417153 to cfcfa42 Compare November 10, 2025 17:59
@codecov
Copy link

codecov bot commented Nov 10, 2025

Codecov Report

❌ Patch coverage is 94.27313% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.61%. Comparing base (10ff5d0) to head (07a7e45).
⚠️ Report is 14 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...tes/matrix-sdk-base/src/store/integration_tests.rs 93.42% 0 Missing and 10 partials ⚠️
crates/matrix-sdk-sqlite/src/state_store.rs 94.28% 0 Missing and 2 partials ⚠️
...ates/matrix-sdk/src/client/thread_subscriptions.rs 97.22% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5848      +/-   ##
==========================================
+ Coverage   88.60%   88.61%   +0.01%     
==========================================
  Files         361      361              
  Lines      102294   102476     +182     
  Branches   102294   102476     +182     
==========================================
+ Hits        90637    90809     +172     
- Misses       7438     7439       +1     
- Partials     4219     4228       +9     

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

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 10, 2025

CodSpeed Performance Report

Merging #5848 will not alter performance

Comparing razvp:thread-subs-bulk-upsert (07a7e45) with main (a3424a7)

Summary

✅ 50 untouched

@razvp razvp force-pushed the thread-subs-bulk-upsert branch from cfcfa42 to 9a19738 Compare November 10, 2025 21:10
@Hywan
Copy link
Member

Hywan commented Nov 11, 2025

Thanks! It looks like a solid contribution, thank you. However, I wonder if you could add a bit of context and to explain what you're doing, and why, please?

@razvp razvp force-pushed the thread-subs-bulk-upsert branch from 9a19738 to 07a7e45 Compare November 12, 2025 08:07
@razvp
Copy link
Author

razvp commented Nov 12, 2025

Thanks! It looks like a solid contribution, thank you. However, I wonder if you could add a bit of context and to explain what you're doing, and why, please?

The sliding sync and back-pagination endpoints provide thread subscription updates in batches, but currently the SDK stores/updates them one by one. (MSC4308)
This PR changes that by processing them in bulk, in one database transaction.

The first commit adds the upsert_thread_subscriptions() method to the StateStore trait and implements it for the 3 storage types. The IndexeddbStateStore and MemoryStore implementations are very similar to the existing single update per transaction
The second commit updates ThreadSubscriptionCatchup::sync_subscriptions and ThreadSubscriptionCatchup::thread_subscriptions_catchup_task to actually use the bulk api.

Most of the bump_stamp logic is gathered from the existing test. (ex: if an update doesn't have a bump_stamp and the stored subscription has one, then keep the existing one)

Switching to a bulk api was suggested in this comment.

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.

store: implement a bulk API to store thread subscriptions

2 participants