Properly handle start sync thread issue
This commit is contained in:
@@ -39,6 +39,15 @@ impl Actor for MatrixManagerActor {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn post_stop(
|
||||||
|
&self,
|
||||||
|
_myself: ActorRef<Self::Msg>,
|
||||||
|
_state: &mut Self::State,
|
||||||
|
) -> Result<(), ActorProcessingErr> {
|
||||||
|
log::error!("[!] [!] Matrix Manager Actor stopped!");
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
async fn handle(
|
async fn handle(
|
||||||
&self,
|
&self,
|
||||||
myself: ActorRef<Self::Msg>,
|
myself: ActorRef<Self::Msg>,
|
||||||
@@ -115,8 +124,15 @@ impl Actor for MatrixManagerActor {
|
|||||||
// Start thread
|
// Start thread
|
||||||
log::debug!("Starting sync thread for {email:?}");
|
log::debug!("Starting sync thread for {email:?}");
|
||||||
let thread_id =
|
let thread_id =
|
||||||
start_sync_thread(client.clone(), state.broadcast_sender.clone(), myself)
|
match start_sync_thread(client.clone(), state.broadcast_sender.clone(), myself)
|
||||||
.await?;
|
.await
|
||||||
|
{
|
||||||
|
Ok(thread_id) => thread_id,
|
||||||
|
Err(e) => {
|
||||||
|
log::error!("Failed to start sync thread! {e}");
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
};
|
||||||
state.running_sync_threads.insert(email, thread_id);
|
state.running_sync_threads.insert(email, thread_id);
|
||||||
}
|
}
|
||||||
MatrixManagerMsg::StopSyncThread(email) => {
|
MatrixManagerMsg::StopSyncThread(email) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user