Skip to content

Commit 49eae86

Browse files
committed
sdk: improve logging for received history bundles
We had an instance where a user joined a room on Element X but did not download the key bundle, so let's add some logging to help figure out what was going on.
1 parent 17df3f8 commit 49eae86

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

crates/matrix-sdk/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ All notable changes to this project will be documented in this file.
88

99
### Features
1010

11+
- Improve logging around key history bundles when joining a room.
12+
([#5866](https://github.com/matrix-org/matrix-rust-sdk/pull/5866))
1113
- Expose the power level required to modify `m.space.child` on
1214
`room::power_levels::RoomPowerLevelChanges`.
1315
([#5857](https://github.com/matrix-org/matrix-rust-sdk/pull/5857))

crates/matrix-sdk/src/client/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ use ruma::{
8181
};
8282
use serde::de::DeserializeOwned;
8383
use tokio::sync::{Mutex, OnceCell, RwLock, RwLockReadGuard, broadcast};
84-
use tracing::{Instrument, Span, debug, error, instrument, trace, warn};
84+
use tracing::{Instrument, Span, debug, error, info, instrument, trace, warn};
8585
use url::Url;
8686

8787
use self::futures::SendRequest;
@@ -1581,6 +1581,7 @@ impl Client {
15811581
room_id: &RoomId,
15821582
pre_join_room_info: Option<PreJoinRoomInfo>,
15831583
) -> Result<Room> {
1584+
info!(?room_id, ?pre_join_room_info, "Completing room join");
15841585
let mark_as_dm = if let Some(room) = self.get_room(room_id) {
15851586
room.state() == RoomState::Invited
15861587
&& room.is_direct().await.unwrap_or_else(|e| {
@@ -1651,6 +1652,7 @@ impl Client {
16511652
/// alias looks like `#name:example.com`.
16521653
/// * `server_names` - The server names to be used for resolving the alias,
16531654
/// if needs be.
1655+
#[instrument(skip(self))]
16541656
pub async fn join_room_by_id_or_alias(
16551657
&self,
16561658
alias: &RoomOrAliasId,

crates/matrix-sdk/src/room/shared_room_history.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ pub(crate) async fn maybe_accept_key_bundle(room: &Room, inviter: &UserId) -> Re
128128
olm_machine.store().get_received_room_key_bundle_data(room.room_id(), inviter).await?
129129
else {
130130
// No bundle received (yet).
131+
info!("No room key bundle from inviter found");
131132
return Ok(());
132133
};
133134

0 commit comments

Comments
 (0)