Commit 9c97b478a8

9c97b478a826cb3b37bc4fb8e31b0d94e5d35ccb

parent: f1ce8559cf

Unsigned

Darafei Praliaskouski <me@komzpa.net> · 2026-09-09 12:31 UTC
committer: <strk@kbt.io>

fix: retain runtime-owned bounded joins after rebase

Layout: unified · split

src/connection.rs +15
@@ -235,6 +235,21 @@ impl Connection {
235235 .map_err(|error| error.to_string())
236236 }
237237
238 /// Bound upgrade joins while polling both the timer and SDK on Tokio.
239 pub async fn join_room_with_timeout(
240 &self,
241 room_id: OwnedRoomId,
242 timeout: std::time::Duration,
243 ) -> Result<Result<Room, matrix_sdk::Error>, tokio::time::error::Elapsed>
244 {
245 let client = self.client().clone();
246 self.spawn(async move {
247 tokio::time::timeout(timeout, client.join_room_by_id(&room_id))
248 .await
249 })
250 .await
251 }
252
238253 pub fn shutdown(&self) {
239254 let runtime = self.runtime();
240255
src/room/mod.rs +8 −20
@@ -57,9 +57,8 @@ use matrix_sdk::{
5757 },
5858 deserialized_responses::AmbiguityChange,
5959 room::{
60 IncludeRelations, RelationsOptions,
6160 reply::{EnforceThread, Reply},
62 Room,
61 IncludeRelations, RelationsOptions, Room,
6362 },
6463 ruma::{
6564 api::Direction,
@@ -727,14 +726,14 @@ impl RoomHandle {
727726
728727 let buffer_handle = build_room_buffer(&buffer_name, room.clone())
729728 .or_else(|_| {
730 if retire_stale_matrix_buffer(&buffer_name, room_id) {
729 if retire_stale_matrix_buffer(&buffer_name, &room_id) {
731730 build_room_buffer(&buffer_name, room.clone())
732731 } else {
733732 Err(())
734733 }
735734 })
736735 .or_else(|_| {
737 let suffix = room_id_buffer_suffix(room_id);
736 let suffix = room_id_buffer_suffix(&room_id);
738737 let fallback_name = if suffix.is_empty() {
739738 format!("{buffer_name}.room")
740739 } else {
@@ -1084,15 +1083,8 @@ impl MatrixRoom {
10841083
10851084 self.print_network(&format!("Following room upgrade to {room_id}..."));
10861085
1087 let client = connection.client().clone();
1088 let target = room_id.clone();
10891086 let result = connection
1090 .spawn(async move {
1091 tokio::time::timeout(SPACE_JOIN_TIMEOUT, async move {
1092 client.join_room_by_id(&target).await
1093 })
1094 .await
1095 })
1087 .join_room_with_timeout(room_id.clone(), SPACE_JOIN_TIMEOUT)
10961088 .await;
10971089
10981090 match result {
@@ -2113,15 +2105,11 @@ impl MatrixRoom {
21132105 "Following room upgrade to {successor_room_id}..."
21142106 ));
21152107
2116 let client = connection.client().clone();
2117 let target = successor_room_id.clone();
21182108 match connection
2119 .spawn(async move {
2120 tokio::time::timeout(SPACE_JOIN_TIMEOUT, async move {
2121 client.join_room_by_id(&target).await
2122 })
2123 .await
2124 })
2109 .join_room_with_timeout(
2110 successor_room_id.clone(),
2111 SPACE_JOIN_TIMEOUT,
2112 )
21252113 .await
21262114 {
21272115 Ok(Ok(successor_room)) => room = successor_room,