Can request sync thread stop
This commit is contained in:
@@ -15,6 +15,7 @@ pub enum MatrixManagerMsg {
|
||||
GetClient(UserEmail, RpcReplyPort<anyhow::Result<MatrixClient>>),
|
||||
DisconnectClient(UserEmail),
|
||||
StartSyncThread(UserEmail),
|
||||
StopSyncThread(UserEmail),
|
||||
SyncThreadTerminated(UserEmail, MatrixSyncTaskID),
|
||||
}
|
||||
|
||||
@@ -117,6 +118,15 @@ impl Actor for MatrixManagerActor {
|
||||
.await?;
|
||||
state.running_sync_threads.insert(email, thread_id);
|
||||
}
|
||||
MatrixManagerMsg::StopSyncThread(email) => {
|
||||
if let Some(thread_id) = state.running_sync_threads.get(&email)
|
||||
&& let Err(e) = state
|
||||
.broadcast_sender
|
||||
.send(BroadcastMessage::StopSyncThread(thread_id.clone()))
|
||||
{
|
||||
log::error!("Failed to request sync thread stop: {e}");
|
||||
}
|
||||
}
|
||||
MatrixManagerMsg::SyncThreadTerminated(email, task_id) => {
|
||||
if state.running_sync_threads.get(&email) == Some(&task_id) {
|
||||
log::info!(
|
||||
|
||||
Reference in New Issue
Block a user