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(send queue): refactor in preparation for media local echoes #4176

Merged
merged 4 commits into from
Oct 29, 2024

Conversation

bnjbvr
Copy link
Member

@bnjbvr bnjbvr commented Oct 28, 2024

This refactors the send queue so that it can apply sending more abstract requests, instead of only sending plain events. This will generalize to media uploads soon, but in the future might also generalize to sending redactions, etc. So we now queue requests, update requests, and so on; which leads to some fun renaming in a massive patch, but no changes in functionality. Those would come in subsequent pull requests.

Indexeddb has a database format change, that is gently handled the same way we did for is_wedged vs wedged errors, that is: the migration applies at the reading boundary (we can't use the #[serde(untagged)] enum trick because we're storing a raw JSON value, and this is known to be buggy in serde). Sqlite hasn't been modified yet.

Part of #1732.

@bnjbvr bnjbvr requested a review from a team as a code owner October 28, 2024 14:54
@bnjbvr bnjbvr requested review from stefanceriu and removed request for a team October 28, 2024 14:54
@bnjbvr bnjbvr force-pushed the bnjbvr/refactor-queued-events branch from 051768a to f0b41e3 Compare October 28, 2024 14:54
Copy link

codecov bot commented Oct 28, 2024

Codecov Report

Attention: Patch coverage is 95.83333% with 7 lines in your changes missing coverage. Please review.

Project coverage is 84.89%. Comparing base (ee80291) to head (acf79a4).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
crates/matrix-sdk/src/send_queue.rs 91.95% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4176      +/-   ##
==========================================
+ Coverage   84.86%   84.89%   +0.02%     
==========================================
  Files         270      271       +1     
  Lines       29031    29035       +4     
==========================================
+ Hits        24637    24648      +11     
+ Misses       4394     4387       -7     

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

@bnjbvr
Copy link
Member Author

bnjbvr commented Oct 28, 2024

Wait, a rename of serialized JSON field names is a breaking change, since the field name is encoded next to the value, IIRC. Will have to do the sqlite migration here too \o/

@bnjbvr bnjbvr marked this pull request as draft October 28, 2024 15:52
@bnjbvr bnjbvr removed the request for review from stefanceriu October 28, 2024 15:52
@bnjbvr
Copy link
Member Author

bnjbvr commented Oct 28, 2024

Wait, a rename of serialized JSON field names is a breaking change, since the field name is encoded next to the value, IIRC. Will have to do the sqlite migration here too \o/

nope

@bnjbvr bnjbvr force-pushed the bnjbvr/refactor-queued-events branch from f0b41e3 to acf9081 Compare October 28, 2024 17:36
@bnjbvr bnjbvr marked this pull request as ready for review October 28, 2024 17:36
@bnjbvr bnjbvr requested review from a team and andybalaam and removed request for a team October 28, 2024 17:39
Copy link
Contributor

@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.

Looks good, and thank you for breaking into consumable parts.

…d_queue module

No changes in functionality, only code motion.
In a next commit, the `QueuedEvent` will be renamed to `QueuedRequest`.
This specifies which kind of request we want to send with the send
queue; for now, it can only be an event.
Changelog: Renamed all the send-queue related "events" to "requests", so
  as to generalize usage of the send queue to not-events (e.g. medias,
  redactions, etc.).
@bnjbvr bnjbvr force-pushed the bnjbvr/refactor-queued-events branch from acf9081 to acf79a4 Compare October 29, 2024 17:00
@bnjbvr bnjbvr enabled auto-merge (rebase) October 29, 2024 17:00
@bnjbvr bnjbvr merged commit 9c858c1 into main Oct 29, 2024
40 checks passed
@bnjbvr bnjbvr deleted the bnjbvr/refactor-queued-events branch October 29, 2024 17: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.

2 participants