-
Notifications
You must be signed in to change notification settings - Fork 258
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
feat(sdk): Do not send a room subscription that has already been sent #3874
feat(sdk): Do not send a room subscription that has already been sent #3874
Conversation
This patch adds the `commit` method on the `StickyData` trait. It is called by `SlidingSyncStickyManager::maybe_commit` when we are sure the data can be validated because of a valid response to the sent request.
This patch introduces the `RoomSubscriptionState` type, to represent whether a room subscription has already been correctly sent to the server.
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.
Makes sense!
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3874 +/- ##
=======================================
Coverage 84.09% 84.10%
=======================================
Files 261 261
Lines 27656 27669 +13
=======================================
+ Hits 23257 23270 +13
Misses 4399 4399 ☔ View full report in Codecov by Sentry. |
Night thought: If sticky parameters are "disabled" (i.e. the server doesn't return the |
This patch uses the new `RoomSubscriptionState` enum to filter room subscriptions that have already been sent, when building a `http::Request` with the sticky parameters. By default, to start, a `http::request::RoomSubscription` is in the state `Pending`, i.e. it's not sent yet. Once the sticky parameters are committed, the state is updated to `Applied`. When the sticky parameters are applied, only the `Pending` room subscriptions are added. This patch contains one test to specifically assert this behaviour.
This patch fixes a test. It now fails, for my own personal joy. The new behaviour is much better.
36640e0
to
4110a1d
Compare
This patch should ideally be reviewed commit-by-commit.
The problem the patch is trying to solve is the following: in sliding sync, for every new room subscriptions, all the previous room subscriptions are part of the request to be send. This is a waste of bandwidth. This patch adds the following feature: when a room subscription has been sent, it won't be part of the next request anymore. All room subscriptions are kept in memory though, but they are marked as
Applied
instead ofPending
(see the newRoomSubscriptionState
type).