Skip to content

refactor(sdk): compute a push context only once when computing push actions for a bunch of events #4962

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

Merged
merged 10 commits into from
Apr 23, 2025

Conversation

bnjbvr
Copy link
Member

@bnjbvr bnjbvr commented Apr 22, 2025

This has three benefits:

  • we don't need to recompute the full push context (which requires a few database accesses each time) when we're calling try_decrypt_event() for lots of events (which can happen when doing /context queries).
  • this makes the workflow very explicit: you may get (or not) a PushContext, and use that to compute the push actions after decrypting
  • we will properly fill the push actions for non-encrypted messages received with /messages at the right time (in self.try_decrypt_event), so we don't need to do it in an extra processing step

This is a preparatory refactoring for threads, since we'll want to use similar logic when fetching the thread roots, or when back-paginating inside a thread.

Part of #4869.

@bnjbvr bnjbvr requested a review from a team as a code owner April 22, 2025 18:06
@bnjbvr bnjbvr requested review from poljar and removed request for a team April 22, 2025 18:06
Copy link

codecov bot commented Apr 22, 2025

Codecov Report

Attention: Patch coverage is 94.33962% with 3 lines in your changes missing coverage. Please review.

Project coverage is 85.98%. Comparing base (7adf60d) to head (e99e448).
Report is 20 commits behind head on main.

Files with missing lines Patch % Lines
...atrix-sdk-base/src/response_processors/timeline.rs 77.77% 2 Missing ⚠️
crates/matrix-sdk-ui/src/notification_client.rs 66.66% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4962   +/-   ##
=======================================
  Coverage   85.98%   85.98%           
=======================================
  Files         325      325           
  Lines       35660    35647   -13     
=======================================
- Hits        30663    30652   -11     
+ Misses       4997     4995    -2     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bnjbvr bnjbvr force-pushed the bnjbvr/refactor-decrypt-chunk branch from be14fa8 to e99e448 Compare April 23, 2025 09:45
@bnjbvr bnjbvr merged commit 426a4ff into main Apr 23, 2025
42 checks passed
@bnjbvr bnjbvr deleted the bnjbvr/refactor-decrypt-chunk branch April 23, 2025 12:49
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