-
Notifications
You must be signed in to change notification settings - Fork 320
SDK: Cache the RTC foci from the well-known file. #5167
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
Conversation
2ffc5cb
to
c72c656
Compare
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## main #5167 +/- ##
========================================
Coverage 90.18% 90.18%
========================================
Files 334 334
Lines 104681 104845 +164
Branches 104681 104845 +164
========================================
+ Hits 94402 94551 +149
- Misses 6226 6239 +13
- Partials 4053 4055 +2 ☔ View full report in Codecov by Sentry. |
c72c656
to
e0f18e7
Compare
I have got a crash testing this branch on Android:
|
Have you got a stack trace for this? |
I have not a lot. Just this:
|
Hmmm, well that line is unchanged in the PR and I'm not massively sure how this works. matrix-rust-sdk/crates/matrix-sdk/src/client/mod.rs Lines 1868 to 1869 in e0f18e7
I set the new field I just added, maybe we can get some clarity in the review 🤔 |
Let's break out the statement:
server_info
.well_known
.as_ref()
.and_then(|well_known| well_known.rtc_foci.clone().into())
I suppose that if the |
Ohhhh, I thought this line was about re-locking access to the I see it clear as day now. Will rename some stuff. Thanks Benji 🙏 |
Ok, I've fixed it in 5476b5c with a double optional but then I decided that the assumption to I'm less sure about how idiomatic the latter commit is - in Swift I would use a KeyPath parameter instead of the problematic closure, but I couldn't find anything like that for Rust. Hence I kept it separate and am happy to revert it or squash it based on feedback :) |
With the latest commits, it's not crashing anymore, but |
Ah, this is presumably because the old data is still cached without a well-known. I've just seen the same thing. Does it work if you call |
80435fe
to
d7f2550
Compare
It did not fix the issue, but I'll build the SDK again with the latest commits |
Tested with d7f2550 and calling |
Huh, it's working great for me both on matrix.org and my test server which doesn't have any RTC foci 🤔 |
Do you want to try |
Hello @pixlwave , here are the logs:
And it's working fine now, so I am not sure what happened previously. |
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.
Working fine on Element X Android on a matrix.org account.
Can this be reviewed now? Could you point to the correct Ruma branch or release? This will get rid of the CI issue. |
ruma/ruma#2091 is not available in the latest Ruma release 0.12.3, so I guess we need to wait for the next release? |
It's part of the stable branch, so we can depend on that ruma/ruma@d1d53e2. |
Note the server-side data is cached for some time, and must be re-fetched after some time. So if you happened to have a cached entry, with the deserialization defaulting to filling the new info as empty if it's not been found during deserialization, then the app could conclude that the info was missing, while it's just outdated. |
@bnjbvr thanks, but I was forcing a refresh by invoking |
I have added a commit, please let me know if it's correct (I am not 💯 sure) and if we need anything else to be able to merge this PR. Thanks! |
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.
Not yet quite right. As the CI also complains about.
Cargo.toml
Outdated
@@ -78,7 +78,7 @@ ruma = { git = "https://github.com/pixlwave/Ruma", branch = "doug/sdk+patches", | |||
"unstable-msc4278", | |||
"unstable-msc4286", | |||
] } | |||
ruma-common = { git = "https://github.com/pixlwave/Ruma", branch = "doug/sdk+patches" } | |||
ruma-common = "0.15.2" |
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.
You need to depend on the same Ruma version for all the Ruma crates, otherwise Rust will complain about types not having the same version.
07dfec2
to
dbf2014
Compare
I've rebased on @bmarty: I think the issue was running |
Thanks, sorry for the delay we had a bit of trouble with our CI setup. I'm going to review this now. |
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.
Ok, I think that this is fine logic-wise. The changelog entries need some fixing though.
crates/matrix-sdk-base/CHANGELOG.md
Outdated
- The cached `ServerCapabilities` has been renamed to `ServerInfo` and additionally contains | ||
the well-known response alongside the existing server versions. Despite the old name, it | ||
does not contain the server capabilities (yet?!). |
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 is now in the completely wrong place, it also lacks a link to the PR. Finally, the "yet?!", feels a bit tacky for a changelog entry.
crates/matrix-sdk/CHANGELOG.md
Outdated
- `ClientServerCapabilities` has been renamed to `ClientServerInfo`. Alongside this, | ||
`Client::reset_server_info` is now `Client::reset_server_info` and `Client::fetch_server_capabilities` | ||
is now `Client::fetch_server_versions`, returning the server versions response directly. |
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 one's in the wrong place as well, please add new entries to the top, so this would have been a merge conflict if it was at the top.
PR link is also missing.
bindings/matrix-sdk-ffi/CHANGELOG.md
Outdated
@@ -22,6 +22,7 @@ Breaking changes: | |||
- `RoomInfo` replaces its field `is_tombstoned: bool` with `tombstone: Option<RoomTombstoneInfo>`, | |||
containing the data needed to implement the room migration UI, a message and the replacement room id. | |||
([#5027](https://github.com/matrix-org/matrix-rust-sdk/pull/5027)) | |||
- `Client::reset_server_capabilities` has been renamed to `Client::reset_server_info`. |
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.
Wrong place, PR link please.
Changelogs updated (TIL you put them in reverse chronological order). |
- `Client::reset_server_capabilities` has been renamed to `Client::reset_server_info`. | ||
([#5167](https://github.com/matrix-org/matrix-rust-sdk/pull/5167)) |
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.
Well that's still in the wrong place, this PR is not part of the 0.12.0 release from two weeks ago.
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.
Ohhhh sorry I see what you're saying, I conflated the ordering comment with the "wrong place" comments… 🙈
crates/matrix-sdk-base/CHANGELOG.md
Outdated
- The cached `ServerCapabilities` has been renamed to `ServerInfo` and | ||
additionally contains the well-known response alongside the existing server versions. | ||
Despite the old name, it does not contain the server capabilities. | ||
([#5167](https://github.com/matrix-org/matrix-rust-sdk/pull/5167)) |
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 one is under the 0.11.0 release, which is happened two months ago.
crates/matrix-sdk/CHANGELOG.md
Outdated
- `ClientServerCapabilities` has been renamed to `ClientServerInfo`. Alongside this, | ||
`Client::reset_server_info` is now `Client::reset_server_info` and `Client::fetch_server_capabilities` | ||
is now `Client::fetch_server_versions`, returning the server versions response directly. | ||
([#5167](https://github.com/matrix-org/matrix-rust-sdk/pull/5167)) |
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 one is under the 0.12.0 release.
a93a542
to
0df12a7
Compare
It has nothing to do with /capabilities so is confusing. We can use this new struct to combine the well-known response into a single cache too.
0df12a7
to
e69b33f
Compare
Alright, moved 👍 Out of interest, are there any plans to adopt Towncrier for these changelogs? It would be an awful lot easier for contributors (especially as we use them elsewhere) 🙂 |
No, we had plans to use I think towncrier would reintroduce some of the downsides |
What were the downsides of git-cliff? Towncrier doesn't use commits, just changelog entries as a text file so it mimicks what we're doing right now updating the CHANGELOG.md, but eradicates conflicts, accidentally rebasing entries into the wrong version and semi-automates the PR link generation (from the file number). It would be a very nice improvement to the workflow :) We could quite easily set up a |
This PR makes the following changes:
ServerCapabilities
intoServerInfo
/capabilities
and was confusing./.well-known/matrix/client
response in theServerInfo
cache.Client::rtc_foci
which uses the cached well-known.Client::is_livekit_rtc_supported
to the FFI using the cache RTC foci.Requires ruma/ruma#2091 before merging