-
Notifications
You must be signed in to change notification settings - Fork 270
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): generalize stored send queue data #4200
Conversation
…dent requests This makes it possible to have different kinds of *parent key*, to update a dependent request. A dependent request waits for the parent key to be set, before it can be acted upon; before, it could only be an event id, because a dependent request would only wait for an event to be sent. In a soon future, we're going to support uploading medias as requests, and some subsequent requests will depend on this, but won't be able to rely on an event id (since an upload doesn't return an event/event id). Since this changes the format of `DependentQueuedRequest`, which is directly serialized into the state stores, I've also cleared the table, to not have to migrate the data in there. Dependent requests are supposed to be transient anyways, so it would be a bug if they were many of them in the queue. Since a migration was needed anyways, I've also removed the `rename` annotations (that supported a previous format) for the `DependentQueuedRequestKind` enum.
…`, not a raw event Changelog: The send queue will now store a serialized `QueuedRequestKind` instead of a raw event, which breaks the format. As a result, all send queues have been emptied.
9b197e2
to
e9f90dc
Compare
e9f90dc
to
e08d961
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4200 +/- ##
==========================================
- Coverage 84.90% 84.87% -0.03%
==========================================
Files 271 271
Lines 29070 29096 +26
==========================================
+ Hits 24681 24695 +14
- Misses 4389 4401 +12 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, but since you removed the migration test, do we have more migration tests that will run and check if everything is fine?
Also, do we want to double check on the app side that this indeed won't break in some unexpected way?
crates/matrix-sdk/src/send_queue.rs
Outdated
@@ -953,9 +957,17 @@ impl QueueStorage { | |||
) -> Result<bool, RoomSendQueueError> { | |||
let store = client.store(); | |||
|
|||
let parent_key = de.parent_key; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
de
is a pretty bad name on its own, but it seems that it is doubly so because dependent events got renamed to dependent requests. So perhaps it's time to rename the variable here, please don't rename it to dqr
.
Thanks for the review. As discussed in chat, I'll add back the migration test, and will make sure it checks that the content has now been cleared in the send queue, so we have some proof this is going to happen. |
… and dependent events are cleared Because the latest migration would clear events to-be-sent from the send queue, we need to reflect this in this test.
e08d961
to
03b1e32
Compare
See the first commit message, which explains the whole point.
Because of this PR, the send queue events and dependent events tables are both cleared, because there's a change in the format of serde-serialized data, and I didn't bother to write a migration for those. Events stuck in there would only be wedged events, or events that were still in the queue before closing the app; worst case scenario is some users lose some messages they tried to send before an update of an app. Is that OK? otherwise, can look into a sane migration, if needs be.
Part of #1732, blocks #4195.