Do not start sync thread if user is disconnected
This commit is contained in:
@@ -298,6 +298,11 @@ impl MatrixClient {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Check whether a user is currently connected to this client or not
|
||||||
|
pub fn is_client_connected(&self) -> bool {
|
||||||
|
self.client.is_active()
|
||||||
|
}
|
||||||
|
|
||||||
/// Disconnect user from client
|
/// Disconnect user from client
|
||||||
pub async fn disconnect(self) -> anyhow::Result<()> {
|
pub async fn disconnect(self) -> anyhow::Result<()> {
|
||||||
if let Err(e) = self.client.logout().await {
|
if let Err(e) = self.client.logout().await {
|
||||||
|
|||||||
@@ -102,6 +102,13 @@ impl Actor for MatrixManagerActor {
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if !client.is_client_connected() {
|
||||||
|
log::warn!(
|
||||||
|
"Cannot start sync thread for {email:?} because Matrix account is not set!"
|
||||||
|
);
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
// Start thread
|
// Start thread
|
||||||
log::debug!("Starting sync thread for {email:?}");
|
log::debug!("Starting sync thread for {email:?}");
|
||||||
let thread_id =
|
let thread_id =
|
||||||
|
|||||||
Reference in New Issue
Block a user