feat(client): have the Client hold one task monitor

This commit is contained in:
Benjamin Bouvier
2026-01-28 10:15:31 +01:00
parent 334bd04252
commit 561b04cab0
+11
View File
@@ -39,6 +39,7 @@ use matrix_sdk_base::{
WellKnownResponse,
},
sync::{Notification, RoomUpdates},
watchdog::TaskMonitor,
};
use matrix_sdk_common::ttl_cache::TtlCache;
#[cfg(feature = "e2e-encryption")]
@@ -383,6 +384,9 @@ pub(crate) struct ClientInner {
#[cfg(feature = "experimental-search")]
/// Handler for [`RoomIndex`]'s of each room
search_index: SearchIndex,
/// A monitor for background tasks spawned by the client.
pub(crate) task_monitor: TaskMonitor,
}
impl ClientInner {
@@ -449,6 +453,7 @@ impl ClientInner {
#[cfg(feature = "experimental-search")]
search_index: search_index_handler,
thread_subscription_catchup,
task_monitor: TaskMonitor::new(),
};
#[allow(clippy::let_and_return)]
@@ -3312,6 +3317,12 @@ impl Client {
media_store: media_store_size,
})
}
/// Get a reference to the client's task monitor, for spawning background
/// tasks.
pub(crate) fn task_monitor(&self) -> &TaskMonitor {
&self.inner.task_monitor
}
}
/// Contains the disk size of the different stores, if known. It won't be